Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HTTP/OAS] Add descriptions for role management APIs #184265

Merged
merged 7 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export function defineDeleteRolesRoutes({ router }: RouteDefinitionParams) {
router.delete(
{
path: '/api/security/role/{name}',
options: {
description: `Delete a role`,
},
validate: {
params: schema.object({ name: schema.string({ minLength: 1 }) }),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export function defineGetRolesRoutes({
router.get(
{
path: '/api/security/role/{name}',
options: {
description: `Get a role`,
},
validate: {
params: schema.object({ name: schema.string({ minLength: 1 }) }),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ export function defineGetAllRolesRoutes({
config,
}: RouteDefinitionParams) {
router.get(
{ path: '/api/security/role', validate: false },
{
path: '/api/security/role',
options: {
description: `Get all roles`,
},
validate: false,
},
createLicensedRouteHandler(async (context, request, response) => {
try {
const hideReservedRoles = buildFlavor === 'serverless';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export function definePutRolesRoutes({
router.put(
{
path: '/api/security/role/{name}',
options: {
description: `Create or update a role`,
},
validate: {
params: schema.object({ name: schema.string({ minLength: 1, maxLength: 1024 }) }),
query: schema.object({ createOnly: schema.boolean({ defaultValue: false }) }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ describe('Invalidate sessions routes', () => {
});

it('correctly defines route.', () => {
expect(routeConfig.options).toEqual({ tags: ['access:sessionManagement'] });
expect(routeConfig.options).toEqual({
description: 'Invalidate user sessions',
tags: ['access:sessionManagement'],
});

const bodySchema = (routeConfig.validate as any).body as ObjectType;
expect(() => bodySchema.validate({})).toThrowErrorMatchingInlineSnapshot(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export function defineInvalidateSessionsRoutes({ router, getSession }: RouteDefi
),
}),
},
options: { tags: ['access:sessionManagement'] },
options: {
tags: ['access:sessionManagement'],
description: `Invalidate user sessions`,
},
},
async (_context, request, response) => {
return response.ok({
Expand Down