mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
refactor: add changeset and improve code
This commit is contained in:
parent
e24ff76c1f
commit
d51e839cdb
3 changed files with 12 additions and 6 deletions
8
.changeset/heavy-badgers-jog.md
Normal file
8
.changeset/heavy-badgers-jog.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
"@logto/core": patch
|
||||
---
|
||||
|
||||
fix OpenAPI schema returned by the `GET /api/swagger.json` endpoint
|
||||
|
||||
1. The `:` character is invalid in parameter names, such as `organizationId:root`. These characters have been replaced with `-`.
|
||||
2. The `tenantId` parameter of the `/api/.well-known/endpoints/{tenantId}` route was missing from the generated OpenAPI spec document, resulting in validation errors. This has been fixed.
|
|
@ -236,9 +236,8 @@ export default function swaggerRoutes<T extends AnonymousRouter, R extends Route
|
|||
(previous, entityName) => ({
|
||||
...previous,
|
||||
...buildPathIdParameters(entityName),
|
||||
...customParameters(),
|
||||
}),
|
||||
{}
|
||||
customParameters()
|
||||
),
|
||||
},
|
||||
tags: [...tags, ...additionalTags].map((tag) => ({ name: tag })),
|
||||
|
|
|
@ -253,11 +253,10 @@ export const buildPathIdParameters = (
|
|||
};
|
||||
|
||||
/**
|
||||
* Build a parameter object for the `tenantId` parameter.
|
||||
* @returns The parameter object for the `tenantId` parameter.
|
||||
* Build a parameter object with additional parameters that are not inferred from the path.
|
||||
*/
|
||||
export const customParameters = (): Record<string, OpenAPIV3.ParameterObject> => {
|
||||
return {
|
||||
return Object.freeze({
|
||||
tenantId: {
|
||||
name: 'tenantId',
|
||||
in: 'path',
|
||||
|
@ -267,5 +266,5 @@ export const customParameters = (): Record<string, OpenAPIV3.ParameterObject> =>
|
|||
type: 'string',
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue