Skip to content

Question regarding to SchemaProps.ID #23

Closed

Description

@rmohr

If I look at the SchemaProps definition, I see that the ID is marshalled into json:

type SchemaProps struct {
	ID                   string            `json:"id,omitempty"`
}

Is there a specific reason for that? Because when I marshal the definitions to json, this ID is also added, but according to openapi the id field is not part of the spec and the validation in some validators fails.

Can we change that to json:"-,omitempty" or is there another way of marshalling the spec?

/cc @emicklei @wsong

Activity

  1. casualjim commented on Mar 18, 2017

    @casualjim
    Member

    I found jsonschema compatibility more important. Do you have a concrete example of a validator that fails?

  2. rmohr commented on Mar 22, 2017

    @rmohr
    Author

    Sorry for the late response.

    Examples are:

    You can pass in the petshop example and add the id field there.

    They do a schema validation too and since it is not part of the schema, they complain about it.

  3. added a commit that references this issue on Jan 9, 2024
    462cfb0
  4. added a commit that references this issue on Jan 9, 2024
    63dcade
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址