Skip to content

support boolean json schema #1228

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

Merged
merged 2 commits into from
Jul 18, 2023
Merged

Conversation

m-ronchi
Copy link
Contributor

Changes

fixes #1227

I wasn't able to update the SchemaObject type, adding boolean | to it broke other stuff with long & cryptic errors, including

                Type 'ReferenceObject | OperationObject | undefined' is not assignable to type 'OperationObject | ReferenceObject | undefined'.

Checklist

  • Unit tests updated
  • README updated
  • examples/ directory updated (only applicable for openapi-typescript)

@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2023

🦋 Changeset detected

Latest commit: 6e0d0dd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openapi-typescript Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@drwpow
Copy link
Contributor

drwpow commented Jul 18, 2023

I wasn't able to update the SchemaObject type, adding boolean | to it broke other stuff with long & cryptic errors

Oh right I can see that happening. I think omitting it is probably best for now. The test covers that scenario pretty well.

expect(transformSchemaObject(true as any, options)).toBe("unknown");
});
it("false", () => {
expect(transformSchemaObject(false as any, options)).toBe("never");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great tests!

@drwpow drwpow merged commit 3107f1e into openapi-ts:main Jul 18, 2023
@github-actions github-actions bot mentioned this pull request Jul 18, 2023
@m-ronchi m-ronchi deleted the boolean-json-schema branch July 19, 2023 08:26
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

Successfully merging this pull request may close these issues.

JsonSchema 'true' produces literal 'true' type instead of unknown
2 participants