wolfadex / elm-open-api-cli

A CLI tool for generating Elm modules from Open API specs.
https://www.npmjs.com/package/elm-open-api
26 stars 7 forks source link

Some definitions fail to generate correctly in generated output #65

Closed jamesrweb closed 6 months ago

jamesrweb commented 7 months ago

When generating the SpaceTraders API from their spec, the generated output is invalid. For example some types have no definitions.

Command:

elm-open-api \"https://stoplight.io/api/v1/projects/spacetraders/spacetraders/nodes/reference/SpaceTraders.json?fromExportButton=true&snapshotType=http_service&deref=optimizedBundle\" --output-dir src --module-name \"Generated.SpacetradersApi\" --generateTodos true

Example of the issue: Screenshot 2024-03-31 223317

Also there are cases such as type alias ActivityLevel = String but this type should be limited to the 4 valid values WEAK, GROWING, STRONG, RESTRICTED as documented in the spec. - Striked out as this is an issue with their own types in the spec.

Notes:

No errors are thrown during generation but warnings about Warning: Error! Multiple security requirements but this is expected? I suppose this is something being worked on still, or what's the plan for security topics?

jamesrweb commented 7 months ago

I also see that cases such as Agent and their related validations are not correctly generated also, for example lengths or ranges don't seem to be tested, only that the field exists.

wolfadex commented 7 months ago

This should be resolved by #80

wolfadex commented 7 months ago

I also see that cases such as Agent and their related validations are not correctly generated also, for example lengths or ranges don't seem to be tested, only that the field exists.

Moving this to it's own issue as it seems worth discussing more, and it separate from bad code gen.

jamesrweb commented 6 months ago

Works like a charm 👍🏻!