GeoJSON-Net / GeoJSON.Net

.Net library for GeoJSON types & corresponding Json.Net (de)serializers
MIT License
444 stars 167 forks source link

Swagger / NSwag support #107

Open jochenjonc opened 6 years ago

jochenjonc commented 6 years ago

Hi,

Has anyone used the GeoJSON.Net library in combination with NSwag?

I've tried and the problems I have are for instance the lack of parameterless constructor on the geometry types. Or maybe if the types would all have an interface it would work also.

Regards,

Jochen

matt-lethargic commented 5 years ago

No, I'll try and give it a go and see where any problems are.

dave-yotta commented 9 months ago

The problem is that IGeometryObject is not compatible with geojson:

Point.Coordinates is an IPosition[] with lat,long and alt properties, not a float[]. This leads to incorrect jsonschema being generated.

Edit: My mistake - there are JsonConverters on the IPosition properties although nswag doesn't use that to transform the schema. That's easy to "fix" with a typemapper. IGeometryObject or IGeoJSONObject doesn't have a JsonInheritanceConverter which is more difficult to work around.