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

Handle when an entry in the definitions section is not an object #6

Open
SDParish opened this issue Nov 6, 2020 · 0 comments
Open

Comments

@SDParish
Copy link

SDParish commented Nov 6, 2020

i.e. it is a primitive type and has no properties property

As far as I can see primitive types are allowed as definitions entries, however the code in GenerateModels.php::generate() creates a new class for each, and assumes that the properties property both exists and is an array, leading to an error when it tries to use it and it doesn't exist/is treated as null.

The code should check the type specified, and act accordingly.
Whether that means no class generated (and so the primitive type would be used elsewhere rather than a Model), or a wrapper Model that holds the primitive (and applies pattern/formats/other properties as per the spec) can be decided when implementing.

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

No branches or pull requests

1 participant