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

fix: support boolean schemas #605

Merged
merged 8 commits into from Apr 24, 2024
Merged

fix: support boolean schemas #605

merged 8 commits into from Apr 24, 2024

Conversation

emonadeo
Copy link
Contributor

@emonadeo emonadeo commented Mar 26, 2024

oazapfts codegen fails if the api contains boolean json schema.

{
  // ...
  "schemas": {
    "Foo": {
      "type": "object",
      "required": ["bar"],
      "properties": {
        "bar": true
      },
      "additionalProperties": false
    }
  }
}

This PR adds support for these, mapping true to any and false to never.

I am not sure about how this should behave with "TrueEnums" (not sure what that is i get it now, these are typescript enums), so please review with extra care, as I am not familiar with the codebase and don't understand every corner of it.

This is an upstream issue with kogosoftwarellc/open-api, which is also missing boolean schema support (I filed a PR to fix this at kogosoftwarellc/open-api#902).

@Xiphe
Copy link
Collaborator

Xiphe commented Apr 22, 2024

Hi @emonadeo!

Thank you for the contribution and sorry for the late reply, I currently don't have much capacity for this project.

Could you help me wrap my head around why and where this is useful in the context of Open API Spec?
I don't want to imply, it's not useful. At the same time, as a maintainer of this I try to understand how people use the Spec and what they feed into the codegen and why.

@emonadeo
Copy link
Contributor Author

I personally don't use boolean json schema but others do and some codegen tools use it as well. Right now oazapfts just errors when trying to generate a client from such an openapi file.

Copy link
Collaborator

@Xiphe Xiphe left a comment

Choose a reason for hiding this comment

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

Solid work! I have some minor change requests 🤓

packages/codegen/src/generate.ts Show resolved Hide resolved
packages/codegen/src/generate.ts Show resolved Hide resolved
packages/codegen/src/generate.ts Show resolved Hide resolved
packages/codegen/src/generate.ts Outdated Show resolved Hide resolved
packages/codegen/src/generate.ts Outdated Show resolved Hide resolved
@Xiphe Xiphe merged commit cf5c99c into oazapfts:main Apr 24, 2024
1 check passed
Copy link

🎉 This PR is included in version oazapfts-v6.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants