Skip to content

Commit d86cb77

Browse files
authored
Fixed Format and Readonly properties displaying (#2296)
* Fixed non-working images in API descriptions * Removed duplicated styles * Fixed Format and Readonly properties displaying * Double quotes ES lint fix
1 parent 3a67d03 commit d86cb77

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎src/models/typeDefinition.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,15 @@ export abstract class TypeDefinitionProperty {
116116
constructor(name: string, contract: SchemaObjectContract, isRequired: boolean) {
117117
this.name = contract.title || name;
118118
this.description = contract.description;
119-
this.type = new TypeDefinitionPropertyTypePrimitive(contract.format || contract.type || "object");
120119
this.readOnly = contract.readOnly ?? false;
121120
this.required = isRequired;
122121

122+
const typeAndFormat =
123+
contract.type
124+
? contract.format ? contract.type + " (" + contract.format + ")" : contract.type
125+
: "object";
126+
this.type = new TypeDefinitionPropertyTypePrimitive(typeAndFormat);
127+
123128
if (contract.rawSchemaFormat) {
124129
this.rawSchema = contract.rawSchema;
125130
this.rawSchemaFormat = contract.rawSchemaFormat;
@@ -365,7 +370,7 @@ export class TypeDefinitionObjectProperty extends TypeDefinitionProperty {
365370
const propertySchemaObject = item.properties[propertyName];
366371
const propertyNameToDisplay = (prefix ? prefix + "." : "") + propertyName;
367372

368-
hasReadOnly = propertySchemaObject.readOnly ?? false;
373+
if (!hasReadOnly) hasReadOnly = propertySchemaObject.readOnly ?? false;
369374

370375
if (!propertySchemaObject) {
371376
return;

0 commit comments

Comments
 (0)