Skip to content

Decode ExtensionProps (OAP 3) #110

@perriea

Description

@perriea

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 !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions