Skip to content

Commit

Permalink
Fixed Format and Readonly properties displaying (#2296)
Browse files Browse the repository at this point in the history
* Fixed non-working images in API descriptions

* Removed duplicated styles

* Fixed Format and Readonly properties displaying

* Double quotes ES lint fix
  • Loading branch information
jsorohova authored Sep 20, 2023
1 parent 3a67d03 commit d86cb77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/models/typeDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,15 @@ export abstract class TypeDefinitionProperty {
constructor(name: string, contract: SchemaObjectContract, isRequired: boolean) {
this.name = contract.title || name;
this.description = contract.description;
this.type = new TypeDefinitionPropertyTypePrimitive(contract.format || contract.type || "object");
this.readOnly = contract.readOnly ?? false;
this.required = isRequired;

const typeAndFormat =
contract.type
? contract.format ? contract.type + " (" + contract.format + ")" : contract.type
: "object";
this.type = new TypeDefinitionPropertyTypePrimitive(typeAndFormat);

if (contract.rawSchemaFormat) {
this.rawSchema = contract.rawSchema;
this.rawSchemaFormat = contract.rawSchemaFormat;
Expand Down Expand Up @@ -365,7 +370,7 @@ export class TypeDefinitionObjectProperty extends TypeDefinitionProperty {
const propertySchemaObject = item.properties[propertyName];
const propertyNameToDisplay = (prefix ? prefix + "." : "") + propertyName;

hasReadOnly = propertySchemaObject.readOnly ?? false;
if (!hasReadOnly) hasReadOnly = propertySchemaObject.readOnly ?? false;

if (!propertySchemaObject) {
return;
Expand Down

0 comments on commit d86cb77

Please sign in to comment.