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

OpenAPI/Swagger struct generation #69

Open
denismakogon opened this issue Aug 10, 2018 · 0 comments
Open

OpenAPI/Swagger struct generation #69

denismakogon opened this issue Aug 10, 2018 · 0 comments

Comments

@denismakogon
Copy link

Nice to see that I'm not the only one who wants to generate code from JSON.
However, plain JSON/YAML is the only notation that can be used as a source for code generation.

I'd like to propose OpenAPI V3 generation, assume you have the following JSON file:

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        },
        "fields": {
          "type": "string"
        }
      }
    }
  }
}

this JSON file may end up in a go struct like:

type Error struct {
    Message string `json:"message"`
    Fields string `json:"fields"`
}

type SomeStruct struct {
    Error Error `json:"error"`
}

thoughts?

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

No branches or pull requests

1 participant