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

Add null safe operator in case $schema is null #787

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

vaidas-lungis
Copy link

@vaidas-lungis vaidas-lungis commented Feb 20, 2024

Fixes

PHP Fatal error:  Uncaught Error: Call to a member function getType() on null in <PROJECT_DIR>/vendor/jane-php/open-api-3/Generator/RequestBodyContent/AbstractBodyContentGenerator.php:35

I had a case when open api specification is valid (according to swagger.io tool) but few endpoints requestBody>content elements didn't had any schema property (application/xml) and it causes issues while generating PHP code (./vendor/bin/jane-openapi generate).

Fixes 

```
PHP Fatal error:  Uncaught Error: Call to a member function getType() on null in /...vendor/jane-php/open-api-3/Generator/RequestBodyContent/AbstractBodyContentGenerator.php:35
```

I had a case when open api specification was valid (according to swagger) but requestBody>content element didn't had any schema and it caused issues while generating PHP code
Copy link
Member

@Korbeil Korbeil left a comment

Choose a reason for hiding this comment

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

Thanks @vaidas-lungis for your contribution ! It looks good to me :)
Could you add a test to validate this issue and a note in the CHANGELOG file about your changes ?
Thanks again 🙏

@vaidas-lungis
Copy link
Author

I will try to do that ;)

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.

None yet

2 participants