geocoders / geocodejson-spec

DRAFT An attempt to have standard geojson responses from geocoders.
37 stars 10 forks source link

Proposal of an official JSON Schema for geocodejson #24

Closed jenkin closed 1 year ago

jenkin commented 1 year ago

I'm working on an OpenAPI spec of Openstreetmap Nominatim API, describing the GeocodeJSON format using JSON Schema.

In #21 @DanielJDufour had already proposed the idea of defining a json schema for gecodejson.

Here you can find a draft of GeocodeJSON schema modeling the spec: https://github.com/jenkin/geocodejson-spec/blob/feature/json-schema/src/geocodejson.schema.json (also deferenced and bundled).

So in a custom schema you can refer to the official one using $ref attribute (ie. in an openapi spec).

{
    "responses": {
        "200": {
            "description": "OK",
            "content": {
                "application/json": {
                    "schema": {
                        "type": "array",
                        "items": {
                            "$ref": "https://geocoders.github.io/geocodejson-spec/draft/geocodejson.schema.json"
                        }
                    }
                }
            }
        }
    }
}

I know this project is quite dormant, but if you want I can open a PR from this branch.

DanielJDufour commented 1 year ago

I'm not sure if this project is still active, but wanted to say awesome work. Whether it lives in this repo or another, I think the community would definitely benefit from the new schema you defined.

yohanboniface commented 1 year ago

@jenkin cool! Yep, let's go, let's PR, this can be useful for others :)

This repo is indeed not very active, but we do use this spec and does not have other needs yet and I personally do not have the time/energy at the moment to finish the move and release a proper spec, but if you, both, have time, please go ahead :)

jenkin commented 1 year ago

@yohanboniface I have no experience in publishing proper spec, but we can try to release this draft as a v1.