Skip to content

extension fields in info.contact do not propagate to embedded spec #2054

@mrwonko

Description

@mrwonko

Problem statement

I need to add an extension field info.contact.x-teams to the spec served by the generated server, but the extension field is dropped during generation. I don't need to access it in my code, I just need it to get passed on so tools parsing our swagger specs can make use of it.

Swagger specification

swagger: "2.0"
info:
  title: "go-swagger extension field bug repro"
  version: 0.1-bugrepro
  contact:
    email: "this-is-retained@example.com"
    x-teams: "I'd love for this field to show up in in the embedded spec"
  x-ok: "here extension fields work"
paths:
  "/foo":
    get:
      responses:
        200:
          description: OK

Steps to reproduce

swagger generate server --spec swagger.yaml

Resulting embedded_spec:

{
  "swagger": "2.0",
  "info": {
    "title": "go-swagger extension field bug repro",
    "contact": {
      "email": "this-is-retained@example.com"
    },
    "version": "0.1-bugrepro",
    "x-ok": "here extension fields work"
  },
  "paths": {
    "/foo": {
      "get": {
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}

Environment

swagger version: v0.20.1
go version: go1.12.9 darwin/amd64
OS: macOS Mojave 10.14.6

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions