Skip to content

Commit

Permalink
fix(): minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Mar 19, 2021
1 parent a6c3a0e commit 263a7b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion e2e/api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
"tags": {
"type": "array",
"items": {
"type": "string"
"type": "string",
"format": "uri"
}
},
"createdAt": {
Expand Down
1 change: 1 addition & 0 deletions e2e/src/cats/dto/create-cat.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class CreateCatDto {
readonly breed: string;

@ApiProperty({
format: 'uri',
type: [String]
})
readonly tags?: string[];
Expand Down
6 changes: 4 additions & 2 deletions lib/services/schema-object-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,14 @@ export class SchemaObjectFactory {
'minLength',
'pattern'
];
const moved = pick(metadata, keysToMove);
const movedProperties = pick(metadata, keysToMove);
const schemaHost = {
...omit(metadata, [...keysToRemove, ...keysToMove]),
name: metadata.name || key,
type: 'array',
items: isString(type) ? { type, ...moved } : { ...type, ...moved }
items: isString(type)
? { type, ...movedProperties }
: { ...type, ...movedProperties }
};
schemaHost.items = omitBy(schemaHost.items, isUndefined);
return schemaHost as unknown;
Expand Down

0 comments on commit 263a7b3

Please sign in to comment.