-
Notifications
You must be signed in to change notification settings - Fork 21
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
OpenApiSchemaProperty - Set reference to another OpenApiSchema #558
Comments
First: Second: |
Okay yeah that makes sense, but unfortunately, you can't accomplish this as-is as the library for better and worse follows the whole CakePHP MVC design pattern. I could use this functionality as well for the same reasons you describe. OpenApiDto is strictly built into the schema of requests/responses, so they don't really show up in the Once it did that, at a minimum, you could get to where you want to go with the use of event listeners. If you are interested in building this in I don't think its that hard... Something would need to be added in here https://github.com/cnizzardini/cakephp-swagger-bake/blob/2.x/src/Lib/Swagger.php#L71 that generates the custom schema. Then the config https://github.com/cnizzardini/cakephp-swagger-bake/blob/2.x/src/Lib/Configuration.php would need to support registering those custom schemas (which you were hoping it did in your initial issue post). That would really just be giving it a list of namespaces to look at. |
Hey, thank you for all that support. I’ve now tried to address my requirements using Swagger-PHP, and there’s already an out-of-the-box solution available. However, this also means that a lot of manual annotations are required, which can be both a curse and a blessing. Your solution was quiet simple. :-) Thank you for that! My first API endpoint already seems to work with DTOs, and the OpenAPI documentation is well-structured here with that relation between DTOs. I think it’s best not to reinvent the wheel in this case. best regards from germany |
If I were at the point where I had to annotate everything with Swagger-PHP I'd just maintain the OpenAPI YAML myself... but, do as you wish. |
Another question, or perhaps a suggestion for improvement.
Is it possible to set an OpenAPISchemaProperty as an object that references another OpenAPISchema like this?
Additionally, how can I retrieve the DTOs as a schema from the ApiPlugin\Model\DTO namespace?
Below is my swagger_bake.php file.
The text was updated successfully, but these errors were encountered: