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

required not handled in oneOf clause #151

Open
gabormagyar opened this issue May 3, 2023 · 0 comments
Open

required not handled in oneOf clause #151

gabormagyar opened this issue May 3, 2023 · 0 comments

Comments

@gabormagyar
Copy link

See reproduced example here:
https://codesandbox.io/p/sandbox/openapi-sampler-oneof-bug-ignfcs

I have the following schema:

{
  type: "object",
  properties: {
    a: {
      type: "string",
    },

    b: {
      type: "string",
    },
  },
  oneOf: [
    {
      required: ["a"],
    },
    {
      required: ["b"],
    },
  ],
};

Since either a is required or b is required I would expect {a: "string"} or {b: "string"} to be correct examples for this schema.

openapi-sampler produces {a: "string", b: "string"} as an example which is incorrect. The error given by asyncapi parser is must match exactly one schema in oneOf.

If I add the {skipNonRequired: true} option then the example becomes {} which is also incorrect.

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