feat: support for x-discriminator-value for 2.0 as alternative to mapping (#534)

Add vendor extension `x-discriminator-value `used by swagger-codegen for Swagger 2.0 as an alternative to OpenAPI 3.0 mapping feature.
This commit is contained in:
Lev Pachmanov 2018-06-20 19:08:19 +03:00 committed by Roman Hotsiy
parent 35f83e491a
commit 070dc5c0a8

View File

@ -280,7 +280,7 @@ export class OpenAPIParser {
def.allOf !== undefined &&
def.allOf.find(obj => obj.$ref !== undefined && $refs.indexOf(obj.$ref) > -1)
) {
res['#/components/schemas/' + defName] = defName;
res['#/components/schemas/' + defName] = def['x-discriminator-value'] || defName;
}
}
return res;