Skip to content

required not handled in oneOf clause #151

Description

@gabormagyar

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.

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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions