fix(oas3): compensate for JSON Schemas left unresolved by swagger-client (#9794)

Refs #9790
This commit is contained in:
Oliwia Rogala
2024-04-10 08:41:49 +02:00
committed by GitHub
parent b6b0d2879a
commit 3bea389715
3 changed files with 111 additions and 7 deletions

View File

@@ -66,16 +66,20 @@ export default class Model extends ImmutablePureComponent {
/*
* If we have an unresolved ref, get the schema and name from the ref.
* If the ref is external, we can't resolve it, so we just display the ref location.
* This is for situations where the ref was not resolved by Swagger Client
* because we reached the traversal depth limit.
* This is for situations where:
* - the ref was not resolved by Swagger Client because we reached the traversal depth limit
* - we had a circular ref inside the allOf keyword
*/
if ($ref) {
name = this.getModelName($ref)
const refSchema = this.getRefSchema(name)
const refName = this.getModelName($ref)
const refSchema = this.getRefSchema(refName)
if (Map.isMap(refSchema)) {
schema = refSchema.set("$$ref", $ref)
$$ref = $ref
} else {
schema = refSchema.mergeDeep(schema)
if (!$$ref) {
schema = schema.set("$$ref", $ref)
$$ref = $ref
}
} else if (Map.isMap(schema) && schema.size === 1) {
schema = null
name = $ref
}