Skip to content

openapi3gen Support Named Embedded Structs #426

@austince

Description

@austince

Feature request to respect the json:"name" struct tag on embedded structs. Currently, they are always bubbled up to the parent struct.

type EmbeddedStruct struct {
  ID string
}

type ContainerStruct struct {
  Name string
  EmbeddedStruct `json:"Embedded"`
}

Produces:

{
  "properties": {
    "Name": {
	  "type": "string"
	},
	"ID": {
	  "type": "string"
	}
  },
  "type": "object"
}

Expected:

{
  "properties": {
      "Name": {
        "type": "string"
      },
      "Embedded": {
        "properties": {	
          "ID": {
          "type": "string"
          }
        },
      "type": "object"
      }
    },
  "type": "object"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions