question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Swagger: configure "Example value" format

See original GitHub issue

Hello,

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:open
  • Created 4 years ago
  • Reactions:8
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
gte451fcommented, Jun 2, 2019

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

0reactions
iamamusedcommented, Mar 25, 2022

Any example solution for this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found