OpenAPI v2 $ref with sibling elements not removed
Per JSON Schema 2019-09, $ref is not allowed to have other keywords alongside it until this version.
Both OpenAPI v2 and v3.0 follow a version of JSON Schema below this version and in the OpenAPI documentation for $ref it mentions that sibling elements alongside $ref will be ignored.
I tried serializing an object containing a $ref and a sibling element to proto with both the openapiv2 and openapiv3 library and noticed that the sibling elements were only ignored in openapiv3.
In the below example, the description is kept in the message in OpenAPI v2 but removed from the message in OpenAPI v3. The correct behavior should be to drop that field for both OpenAPI v2 and v3.
"foo" : {
"$ref" : "#/definitions/someRef",
"description" : "description"
},
I believe this is due to openapiv3 using SchemaOrReference to enforce mutual exclusivity and openapiv2 directly embedding the ref. Is this something that can be fixed?