Skip to content

Commit

Permalink
Merge pull request RedHatInsights#1174 from vbelchio/trailing_slashes
Browse files Browse the repository at this point in the history
Adding trailing slashes in the Workspaces endpoints
  • Loading branch information
coderbydesign authored Aug 28, 2024
2 parents 59854c1 + 9d52dac commit a31343c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
20 changes: 12 additions & 8 deletions docs/source/specs/typespec/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ namespace Problems {
model ProblemDetails<Status extends valueof int16> {
@header("content-type") contentType: "application/problem+json";
type?: ProblemType;

@statusCode _: typeof Status;
status?: typeof Status;

title?: string;
detail?: string;

@format("uri")
instance?: string;
}

@error
model Problem403 extends ProblemDetails<Status = 403>{
type: ProblemType.InsufficientPermission,
Expand All @@ -64,7 +64,7 @@ namespace Problems {
@example("Not found")
detail: string
}

alias Problem500 = ProblemDetails<Status = 500>;

@error
Expand All @@ -75,7 +75,7 @@ namespace Problems {
}

alias Problem400AlreadyExists = ProblemDetails<Status = 400>;

alias CommonProblems = Problem401 | Problem403 | Problem500;

namespace Workspace {
Expand All @@ -85,10 +85,10 @@ namespace Problems {
}
}

@route("/workspaces")
@route("/workspaces/")
@tag("Workspaces")
@doc("Operations about workspaces")
namespace Workspaces {
namespace Workspaces {
model BasicWorkspace {
@doc("Workspace A")
name: string = "Workspace A";
Expand Down Expand Up @@ -139,26 +139,29 @@ namespace Workspaces {
@statusCode
statusCode: 204,
}

@doc("Create workspace in tenant")
@summary("Create workspace in tenant")
@post op create(@body body: CreateWorkspaceRequest): CreateWorkspaceResponse | Problems.CommonProblems | Problems.Problem400;

@doc("Get a workspace in tenant")
@summary("Get a workspace in tenant")
@route("{uuid}/")
@get op read(
@doc("Unique identification")
@path uuid: UUID;
): ReadWorkspaceResponse | Problems.CommonProblems | Problems.Problem404;

@doc("Edit a workspace")
@summary("Edit the workspace name or description")
@route("{uuid}/")
@put op update(
@doc("Unique identification")
@path uuid: UUID;
@body body: UpdateWorkspaceRequest
): UpdateWorkspaceResponse | Problems.CommonProblems | Problems.Problem400AlreadyExists ;

@route("{uuid}/")
@patch op patch(
@doc("Unique identification")
@path uuid: UUID;
Expand All @@ -167,6 +170,7 @@ namespace Workspaces {

@doc("Delete a workspace")
@summary("Delete the workspace")
@route("{uuid}/")
@delete op delete(
@doc("Unique identification")
@path uuid: UUID;
Expand Down
8 changes: 4 additions & 4 deletions docs/source/specs/v2/openapi.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ info:
tags:
- name: Workspaces
paths:
/workspaces:
/workspaces/:
post:
tags:
- Workspaces
Expand Down Expand Up @@ -78,7 +78,7 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Workspaces.BasicWorkspace'
/workspaces/{uuid}:
/workspaces/{uuid}/:
get:
tags:
- Workspaces
Expand Down Expand Up @@ -256,7 +256,7 @@ paths:
$ref: '#/components/schemas/UUID'
responses:
'200':
description: 'There is no content to send for this request, but the headers may be useful. '
description: The request has succeeded.
content:
application/json:
schema:
Expand Down Expand Up @@ -348,7 +348,7 @@ paths:
$ref: '#/components/schemas/UUID'
responses:
'204':
description: The request has succeeded and the resource has been deleted.
description: 'There is no content to send for this request, but the headers may be useful. '
'400':
description: The server could not understand the request due to invalid syntax.
content:
Expand Down

0 comments on commit a31343c

Please sign in to comment.