Swagger: configure "Example value" format
See original GitHub issueHello,
We are working on a REST API project based on api-platform which only using JSON:API format. But when we generate the documentation, we cannot have an Example value compliant with JSON:API format.
Actual :
{
"streetLine1": "string",
"state": "string",
"postalCode": "string"
}
Expected (JSON:API format) :
{
"data": {
"type": "Address",
"attributes": {
"streetLine1": "string"
"state": "string",
"postalCode": "string"
}
}
}
Is it possible to open the ApiPlatform\Core\Swagger\Serializer\DocumentationNormalizer class to the extension ? Or do you have an idea to bring us to this outcome ?
Thank you
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Adding Examples
To describe an example value that cannot be presented in JSON or YAML format, specify it as a string: content: application/xml: schema ...
Read more >Setting Example and Description with Swagger
Adding examples to our documentation is important because it makes value formats even more precise. If our models contain fields like date, time ......
Read more >Swagger UI tutorial | Documenting APIs
Change the url value to an online web URL to your Swagger file. For example: https://idratherbewriting.com/learnapidoc/docs/ ...
Read more >Using OpenAPI and Swagger UI
You can use this parameter to set a different validator URL, for example for locally deployed validators (Validator Badge). Setting it to either...
Read more >Enriched Web API Documentation using Swagger ...
However, there are things that we can configure and improve to provide more information to our API consumers. For example, we could perform...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I have a similar issue. It seems that the JSON API support doesn’t extend to property Swapper/OpenAPI docs.
I’ve hit on this option but am at a loss as to how to actually modify default formatting: https://api-platform.com/docs/core/swagger/#overriding-the-openapi-specification
Any example solution for this?