Skip to content

OpenAPI/Swagger struct generation #69

Description

@denismakogon

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions