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.

Consider allow setting up OpenAPI title, not from app name

See original GitHub issue

Hi,

Thanks a lot for this library, I’ve switched to it recently from flask-apispec and really pleased of its api, proper OpenAPI 3 support, and overall developer experience. One more time, thanks a lot!

And I have one thing, that I’d like to discuss. Currently flask-smorest setting up info.title of OpenAPI 3 schema as Flask app name, but I’m not sure this is proper assumption. From my practice OAS 3 title is more likely human friendly string such as “Product API”, not an import name such as “product_api”.

With that in mind, would it be better to allow developer setup API_TITLE via app config as done for API_VERSION?

If you against that change, it still able to setup the title via api.spec.title assignment, but in that case I’d like to fix title context var for redoc or swagger ui templates, to reuse the value from the spec, instead of app name.

I would be glad to provide a PR for both suggestions if you’ll agree with proposed changes

Thanks

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
playpauseandstopcommented, Jun 25, 2020

There is no such kwarg as description in ApiSpec and in OpenAPI 3 Schema itself.

All you need to pass it under info dict,

api = Api(
    app, 
    spec_kwargs={
        "info": {"description": "foo"}
    },
)

In total spec_kwargs is options passed on instatiating ApiSpec instance, https://apispec.readthedocs.io/en/latest/api_core.html#apispec.APISpec

Also you should pass description as Markdown and it will be rendered to HTML by Swagger UI or Redoc, https://spec.openapis.org/oas/v3.0.3#info-object

1reaction
playpauseandstopcommented, Jul 7, 2020

@lafrech

Thanks for your update, #169 LGTM, closing my PR in favour of more complete implementation

Read more comments on GitHub >

github_iconTop Results From Across the Web

F.A.Q - Springdoc-openapi
Each group should have a unique groupName . The OpenAPI description of this group, will be available by default on: http://server:port/context-path/v3/api-docs ...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
In the following description, if a field is not explicitly REQUIRED or described with a MUST or SHALL, it can be considered OPTIONAL....
Read more >
SpringDoc openAPI tool not scanning for APIs in Spring Boot ...
It reads (in part):. when defining a REST Controller, spring allows you to declare @RequestMapping(value = "/init") with no explicit Method and ...
Read more >
Microsoft.Azure.WebJobs.Extensions.OpenApi.Core - GitHub
This extension provides an Azure Functions app with Open API capability for ... NOTE: It is NOT required if your OpenAPI related endpoints...
Read more >
Customization - OpenAPI Generator
This will create a new directory out/generators/my-codegen , with all the files you need to get started - including a README.md . Once...
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