mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-10-31 15:57:30 +03:00 
			
		
		
		
	fix: fix deref logic for oas3.1 (#1767)
This commit is contained in:
		
							parent
							
								
									3b8d6441bd
								
							
						
					
					
						commit
						4fb9c83525
					
				|  | @ -195,7 +195,7 @@ export class OpenAPIParser { | ||||||
|     } |     } | ||||||
|     if (mergeAsAllOf && keys.some((k) => k !== 'description' && k !== 'title' && k !== 'externalDocs')) { |     if (mergeAsAllOf && keys.some((k) => k !== 'description' && k !== 'title' && k !== 'externalDocs')) { | ||||||
|       return { |       return { | ||||||
|         allOf: [resolved, rest], |         allOf: [rest, resolved], | ||||||
|       }; |       }; | ||||||
|     } else { |     } else { | ||||||
|       // small optimization
 |       // small optimization
 | ||||||
|  |  | ||||||
|  | @ -80,7 +80,7 @@ export class SchemaModel { | ||||||
|     makeObservable(this); |     makeObservable(this); | ||||||
| 
 | 
 | ||||||
|     this.pointer = schemaOrRef.$ref || pointer || ''; |     this.pointer = schemaOrRef.$ref || pointer || ''; | ||||||
|     this.rawSchema = parser.shallowDeref(schemaOrRef); |     this.rawSchema = parser.deref(schemaOrRef, false, true); | ||||||
|     this.schema = parser.mergeAllOf(this.rawSchema, this.pointer, isChild); |     this.schema = parser.mergeAllOf(this.rawSchema, this.pointer, isChild); | ||||||
| 
 | 
 | ||||||
|     this.init(parser, isChild); |     this.init(parser, isChild); | ||||||
|  | @ -363,7 +363,7 @@ function buildFields( | ||||||
| ): FieldModel[] { | ): FieldModel[] { | ||||||
|   const props = schema.properties || {}; |   const props = schema.properties || {}; | ||||||
|   const additionalProps = schema.additionalProperties; |   const additionalProps = schema.additionalProperties; | ||||||
|   const defaults = schema.default || {}; |   const defaults = schema.default; | ||||||
|   let fields = Object.keys(props || []).map((fieldName) => { |   let fields = Object.keys(props || []).map((fieldName) => { | ||||||
|     let field = props[fieldName]; |     let field = props[fieldName]; | ||||||
| 
 | 
 | ||||||
|  | @ -384,7 +384,7 @@ function buildFields( | ||||||
|         required, |         required, | ||||||
|         schema: { |         schema: { | ||||||
|           ...field, |           ...field, | ||||||
|           default: field.default === undefined ? defaults[fieldName] : field.default, |           default: field.default === undefined && defaults ? defaults[fieldName] : field.default, | ||||||
|         }, |         }, | ||||||
|       }, |       }, | ||||||
|       $ref + '/properties/' + fieldName, |       $ref + '/properties/' + fieldName, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user