oatpp / oatpp-swagger

OpenApi 3.0.0 docs + Swagger UI for oatpp services
https://oatpp.io/
Apache License 2.0
94 stars 53 forks source link

Implements Generator::decomposeMap for Fields<T> #28

Closed natanael closed 4 years ago

natanael commented 4 years ago

We found out that having only a Fields<Object<MyThing>> reference to a DTO caused it not to show in the OAS document, but the reference to it was there and it broke all our swagger based pipeline.

This should fix the Fields<T> case, I can't think of other valid PairList<A, B> besides PairList<String, T> in a JSON format.

The output OAS file now looks like:

"TaskDto": {
    "type": "object",
    "properties": {
        "description": {
            "type": "string"
        },
        "done": {
            "type": "boolean"
        }
    }
},
// [...]
"tasksByTitle": {
    "type": "object",
    "additionalProperties": {
        "$ref": "#\/components\/schemas\/TaskDto"
    }
},

It would be super nice if we could compare the before and after OAS file as a simple test implementation, I didn't know how to do it in a way that would fit the project guidelines.

lganzzzo commented 4 years ago

Hey @natanael ,

Great work!

This should fix the Fields case, I can't think of other valid PairList<A, B> besides PairList<String, T> in a JSON format.

I thinkPairList<String, T> is good enough. String is the only key allowed here.

Regards, Leonid