Haskell-OpenAPI-Code-Generator / Haskell-OpenAPI-Client-Code-Generator

Generate Haskell client code from an OpenAPI 3 specification
46 stars 19 forks source link

Vital Fixes #111

Closed dfithian closed 3 months ago

dfithian commented 4 months ago

A couple things I changed here:

  1. I added an option to output all schemas. We have types that come through in a Websocket which I added to the spec. The default behavior is to not include schemas unless they are part of an operation.
  2. Newtypes, which wrap a single ref, weren't getting type aliased correctly. I think I did that now.
    components:
    schemas:
    NewtypeFoo:
      description: Wrapper for a foo.
      $ref: '#/components/schemas/InnerFoo'
dfithian commented 3 months ago

Pinging @joel-bach, in case you haven't already seen this.

joel-bach commented 3 months ago

Hey @dfithian

Thank you for the PR, this is a good addition 👍

For the alias change, it would be great if we could have an example in the golden tests for this so it makes it clear what the resulting change looks like (you can just add your example to specifications/z_complex_self_made_example.yml and run update_golden_and_example.sh. Make sure to reference the type as well so it is included in the generated code or activate your new flag for the golden tests).

dfithian commented 3 months ago

Thanks @joel-bach, alright I did that, and I added the --output-all-schemas flag so that it was output from the spec. Let me know if you want me to do that differently.

joel-bach commented 3 months ago

Thank you for the adjustments, looks all good 👍