geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
474 stars 255 forks source link

json is provided for /features/api?f=html instead of html #98

Closed alexandreleroux closed 5 years ago

alexandreleroux commented 5 years ago

As discussed with @tomkralidis , html formatting is correctly provided for the features page /features/?f=html, however, the OpenAPI definition /features/api?f=html generates a response in JSON, not html.

This is true at least for the following public pygeoapi implementation:

tomkralidis commented 5 years ago

Thanks @alexandreleroux. API HTML output is probably best realized by a Swagger UI. The problem is how to integrate this in the install. Any ideas @pvgenuchten / @justb4?

Another option is to have a configuration to point to an external Swagger UI like:

server:
    swagger-ui: http://petstore.swagger.io/?url=

Which an API HTML handler would 301 to https://petstore.swagger.io/?url=https://geo.weather.gc.ca/geomet/features/api

justb4 commented 5 years ago

Isn't this functionality what is also provided by Flasgger and https://github.com/gangverk/flask-swagger ?

tomkralidis commented 5 years ago

@justb4 I think flasgger and Flask-swagger are bound to classes in Python? pygeoapi is not setup that way. We have an offline workflow which generates the OpenAPI Description. The value here is that we are able to scan each dataset configured in pygeoapi and report attributes as OpenAPI parameters.

justb4 commented 5 years ago

ok, I see, also came bit later into the API/Swagger//PyGeoAPI game. From what I learned an external Swagger UI is "the thing"? That was probably a reason that Flask-Swagger forked from Flassger, so different approach.

But ok, so we need an external Swagger-UI? Maybe a Swagger-UI instance on a PyGeoAPI server/domain as discussed? Or we could dynamically generate annotated Flask .py Views from the configured datasets but that may be far-fetched...

pvgenuchten commented 5 years ago

There is no python library (or webservice) which generates an api-documentation-page from an openapi-specification-document? For me it makes most sense to have the interactive-api-documentation at api?f=html and not on some external location. But as a start a forward rule to https://petstore.swagger.io/?url=https://geo.weather.gc.ca/geomet/features/api would give a same experience.

tomkralidis commented 5 years ago

Implemented in #101.