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.

[FEATURE] Let us boost our OpenAPI capabilities!!

See original GitHub issue

Is your feature request related to a problem? Please describe. I want to control the “Example value” of my “Request body”. RIght now, we only get something like this:

{
  "string_field": "string"
}

I should be able to control this behaviour, like

{
  "string_field": "Default value for string_field"
}

Describe alternatives you’ve considered I thought that declaring default values might change the values in the swagger, but even that does not work. It would even be a bad behaviour, as we would tightly couple Swagger documentation with API behaviour.

Additional context Add any other context or screenshots about the feature request here. Screenshot 2019-11-11 at 5 50 49 PM

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
gautamsinghania95commented, Nov 11, 2019

Hi,

The documentation does not contain the “example” field. Can you get this info added, as it helps a lot with OpenAPI configuration.

Thanks for the help!! Closing this ticket 😄

Best, Gautam

2reactions
prostomarkeloffcommented, Nov 11, 2019

Hello! At the moment you already can set the example value of field. For example:

async def create_user(
    uid: int = Query(..., description="Id of user for add to database", example=123),
    is_superuser: bool = Query(..., description="User status", example=True),
):
    new_user: User = await UserQuery.create_user(uid, is_superuser)
    return UserSchema.from_orm(new_user)

More about it: https://fastapi.tiangolo.com/tutorial/query-params-str-validations/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Big thoughts for 4.0 · Issue #2925 · OAI/OpenAPI-Specification
We would like to take an opportunity to discuss what might be some big, radical changes that could be done in a 4.0...
Read more >
OpenAPI 3.0, And What it Means for the Future of Swagger
This webinar: OpenAPI 3.0, And What it Means for the Future of Swagger, provides an in-depth look at the new OpenAPI 3.0 (OAS3.0) ......
Read more >
How I use an OpenAPI spec in my Angular projects
Let me show you how I use OpenAPI to boost up my productivity! Here is a brief introduction if you're not familiar with...
Read more >
Generate a new function app from an OpenAPI specification
This new capability automatically generates all the necessary functions for your API, preconfigured based on the OpenAPI specification.
Read more >
Configure API docs functionality - Redocly
Configuration options for API docs. To control the functionality of your API documentation, specify the configuration options depending on ...
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