Nominatim icon indicating copy to clipboard operation
Nominatim copied to clipboard

Openapi definition

Open PhilippJust opened this issue 5 years ago • 8 comments

Although the documentation of the public api is very good, I'd like to include an openapi definition to allow auto generation of client code. I think this might help developers consuming the api with whatever technology they are using as there are code generators for a load of languages and frameworks out there.

Any thoughts or obligations? Otherwise I'd start writing it and open a pull request. Question would be: Where should be? Inside /docs/api?

PhilippJust avatar Feb 25 '20 06:02 PhilippJust

@PhilippJust We're not sure yet which file location is best. The hostname is probably hardcoded in that file so we'd need to replace it during a Nominatim installation.

Let's use the /website directory, that's where the OpenSearch definition file a crossdomain.xml are currently placed.

https://nominatim.openstreetmap.org/nominatim.xml https://nominatim.openstreetmap.org/crossdomain.xml

mtmail avatar Feb 27 '20 16:02 mtmail

Is there any progress? Would need this: :)

BioPhoton avatar Nov 03 '20 21:11 BioPhoton

Not as far as I'm aware. Happy to take a PR on this. I would suggest to put a template into /website and install it with ./utils/setup.php --setup-website. At least termsofservice and contact need to be configurable.

lonvia avatar Nov 09 '20 10:11 lonvia

Sorry, I originally wanted to go about it but I struggled a lot because the query parameters have a very heavy effect on how the output looks. That's something I couldn't work out to describe elegantly in OpenApi.

PhilippJust avatar Nov 12 '20 15:11 PhilippJust

Sorry, I originally wanted to go about it but I struggled a lot because the query parameters have a very heavy effect on how the output looks. That's something I couldn't work out to describe elegantly in OpenApi.

I was afraid of that, which is why I initially tagged the issue with APIv2. You might get away with defining a separate operation for each format type.

lonvia avatar Nov 12 '20 17:11 lonvia

I'd like to help with this effort. Kindly advise on next steps.

Thanks,

namelus avatar Jan 12 '22 13:01 namelus

You basically have to take the documentation from https://nominatim.org/release-docs/latest/api/Overview/ and convert it into the format as defined in the OpenAPI specification.

lonvia avatar Jan 13 '22 08:01 lonvia

@lonvia We just released the OpenAPI specification of Nominatim API, describing the latest 4.3.2 version: https://github.com/sparkfabrik/nominatim-openapi/releases/tag/v4.3.2

The spec defines also the JSON schema of responses, preferring geocodejson format. It can be explored using the public swagger ui: https://sparkfabrik.github.io/nominatim-openapi/

Please read the README for all details and feel free to ask me anything here or opening issues. Thanks!

cc @PhilippJust @BioPhoton @namelus

jenkin avatar Nov 22 '23 13:11 jenkin