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

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

Closed
mrwonko opened this issue Aug 29, 2019 · 5 comments
Closed

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

mrwonko opened this issue Aug 29, 2019 · 5 comments

Comments

@mrwonko
Copy link

mrwonko commented Aug 29, 2019

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

@fredbi
Copy link
Contributor

fredbi commented Sep 3, 2019

Good catch go-openapi/spec should define both contacts and license to be vendor extensible

@fredbi
Copy link
Contributor

fredbi commented Oct 12, 2019

@kul-amr
Copy link
Contributor

kul-amr commented Nov 29, 2019

Hey - I am new to OSS contribution. Can I work on this task if no one else is attempting ?

@fredbi
Copy link
Contributor

fredbi commented Nov 29, 2019

@kul-amr yes sure, contributions are welcome. I've put some links above.

kul-amr added a commit to kul-amr/go-swagger that referenced this issue Jan 9, 2020
kul-amr added a commit to kul-amr/go-swagger that referenced this issue Jan 13, 2020
… propagate to embedded spec

Signed-off-by: Amruta Kulkarni <amruta9.kulkarni@gmail.com>
casualjim pushed a commit that referenced this issue Feb 2, 2020
@fredbi
Copy link
Contributor

fredbi commented Feb 8, 2021

This has been fixed. Closing.

@fredbi fredbi closed this as completed Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants