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

Schema Marking Property of a $ref as Required Results in oas-schema-check Error #566

Open
sshaw opened this issue Oct 8, 2024 · 1 comment

Comments

@sshaw
Copy link

sshaw commented Oct 8, 2024

Using 0.13.5 with the following:

# ...

schema_a:
  type: object
  properties:
    schema_a_foo:
      type: string

schema_b:
  allOf:
    - $ref: '#/components/schemas/schema_a'
    - type: object
      required:
        - schema_a_foo
        - foo
      properties:
        foo:
          type: string
        bar:
          type: string

Results in an error for schema_a_foo:

`required` field `schema_a_foo` is not defined in `properties`

Is this is correct? We've been using it for sometime without issue and I do see it in Swagger's editor schema_a_foo being marked as required 😅

@LasneF
Copy link

LasneF commented Oct 9, 2024

@sshaw , your structure is correct , it impose that any object following schema_b must have a shema_a_foo field and that it is a string

the issue you are raising is a duplicate of this one
#468

@daveshanley you might close it

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

2 participants