Skip to content

Commit

Permalink
fix(directory-service): adjust swagger criteria param definition
Browse files Browse the repository at this point in the history
Also encoding tags link href to handle slashes in resource urn.
  • Loading branch information
tzuge committed Jan 23, 2025
1 parent db4c02b commit f57320f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/directory-service/src/directory/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function mapResource(apiId: AdspId, resource: Resource) {
href: resource.urn.toString(),
},
tags: {
href: `${apiId}:/resources/${resource.urn}/tags`,
href: `${apiId}:/resources/${encodeURIComponent(resource.urn.toString())}/tags`,
},
},
_embedded: resource.data && {
Expand Down
24 changes: 14 additions & 10 deletions apps/directory-service/src/directory/router/resource.swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,13 @@ components:
description: Criteria for the resources to return.
in: query
required: false
schema:
type: object
properties:
typeEquals:
type: string
content:
application/json:
schema:
type: object
properties:
typeEquals:
type: string
- name: tag
description: Value of the tag.
in: path
Expand Down Expand Up @@ -258,11 +260,13 @@ components:
description: Criteria for the resources to return.
in: query
required: false
schema:
type: object
properties:
typeEquals:
type: string
content:
application/json:
schema:
type: object
properties:
typeEquals:
type: string
responses:
200:
description: Request completed successfully
Expand Down
2 changes: 1 addition & 1 deletion apps/directory-service/src/mongo/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export class MongoDirectoryRepository implements DirectoryRepository {
}

if (criteria.typeEquals) {
query.type = criteria.typeEquals.toString();
query.type = criteria.typeEquals;
}

const docs = await this.resourceModel.find(query).skip(skip).limit(top).exec();
Expand Down

0 comments on commit f57320f

Please sign in to comment.