Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode ExtensionProps (OAP 3) #110

Closed
perriea opened this issue Aug 3, 2019 · 0 comments · Fixed by #304
Closed

Decode ExtensionProps (OAP 3) #110

perriea opened this issue Aug 3, 2019 · 0 comments · Fixed by #304

Comments

@perriea
Copy link

perriea commented Aug 3, 2019

How decode with this library the struct ExtensionProps ?
I succeeded to read: swagger.ExtensionProps.Extensions["x-XXXXXXX"] but the output is a json.RawMessage type = []byte.

Should I use the JSON libraries to decode or we can use a functionality of the library ?

My code:

package main

import (
	"fmt"
	"log"

	"github.com/getkin/kin-openapi/openapi3"
)

func main() {
	loader := openapi3.NewSwaggerLoader()
       
        [...]

	swagger, err := loader.LoadSwaggerFromData(data)
	if err != nil {
		log.Fatal("error", err)
	}

	fmt.Println(string(swagger.Extensions["x-XXXXXXX"].(json.RawMessage)))
}

Is it possible to create an example for decoding this structure ?

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant