georust / geojson

Library for serializing the GeoJSON vector GIS file format
https://crates.io/crates/geojson
Apache License 2.0
276 stars 60 forks source link

Added support for okapi that can be configured as feature #212

Closed doheide closed 7 months ago

doheide commented 1 year ago

Okapi allows automated OpenAPI (AKA Swagger) document generation.

michaelkirk commented 1 year ago

Can you help me understand a bit better how this would be useful for people?

One question I have, why would you want the OpenAPI documentation when we already have the generated rustdocs? It might be reasonable, I'm just not familiar with swagger/okapi and how/why people use it.

lnicola commented 1 year ago

I think it's for web services that consume or return serialized geojson values. So it's for documenting apps that use this crate, and maybe automatically generating client code for different languages.

It seems unfortunate, though, that we need to support this here. What if another OpenAPI implementation shows up? Do we support that one too?

frewsxcv commented 1 year ago

Could this be committed upstream like the other implementations?

heksesang commented 7 months ago

If it is commited here and not contributed upstream instead, I'd suggest the flag should be schemars and not include anything okapi-specific. Support for schemars is useful outside of okapi.

frewsxcv commented 7 months ago

You should be able to use any serde-enabled crate with schemars, and this serde already available for this crate. I'm going to close this since I don't think it makes sense for the geojson crate to contain this functionality

heksesang commented 7 months ago

You won't get a precise JsonSchema if you only have a serde-enabled crate. Their documentation is specific about the schema being less precise. So it would be better if it's actually implemented properly for the geojson types, whether it's implemented here or in schemars.

heksesang commented 7 months ago

You should be able to use any serde-enabled crate with schemars, and this serde already available for this crate. I'm going to close this since I don't think it makes sense for the geojson crate to contain this functionality

The GeoJSON format is literally there as an exchange format for geometric data - how does it not make sense for the geojson crate to then also contain a schema implementation for said format?

urschrei commented 7 months ago

how does it not make sense for the geojson crate to then also contain a schema implementation for said format?

Because there is already a JSON Schema GeoJSON implementation. If you feel that there is a specific need for this crate to provide its own implementation, please open a PR making a case for it.