Skip to content

Commit

Permalink
chore: add API to swagger.json
Browse files Browse the repository at this point in the history
  • Loading branch information
darcyYe committed Mar 20, 2024
1 parent 30ae906 commit f6f9a16
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
49 changes: 49 additions & 0 deletions packages/core/src/routes/logto-config.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,55 @@
}
}
}
},
"/api/configs/jwt-customizer/test": {
"post": {
"summary": "Test JWT customizer",
"description": "Test the JWT customizer script with the given context and token payload.",
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"tokenType": {
"description": "The token type to test the JWT customizer for."
},
"payload": {
"properties": {
"contextSample": {
"description": "The sample context for the JWT customizer script testing purpose."
},
"tokenSample": {
"description": "The sample token payload for the JWT customizer script testing purpose."
},
"envVars": {
"description": "The environment variables for the JWT customizer."
},
"script": {
"description": "The code snippet of the JWT customizer."
}
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "The result of the JWT customizer script."
},
"400": {
"description": "Zod errors in cloud service (data type does not match expectation, can be either request body or response body)."
},
"422": {
"description": "Cloud service syntax error."
},
"500": {
"description": "Cloud service internal error."
}
}
}
}
}
}
5 changes: 0 additions & 5 deletions packages/core/src/routes/logto-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,6 @@ export default function logtoConfigRoutes<T extends AuthedRouter>(
}),
]),
response: jsonObjectGuard,
/**
* Code 400 indicates Zod errors in cloud service (data type does not match expectation, can be either request body or response body).
* Code 422 indicates syntax errors in cloud service.
* Code 500 indicates internal server errors in cloud service.
*/
status: [200, 400, 422, 500],
}),
async (ctx, next) => {
Expand Down

0 comments on commit f6f9a16

Please sign in to comment.