Skip to content

Commit

Permalink
Extract HttpMethod.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Dec 10, 2024
1 parent 2612721 commit 958c971
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
13 changes: 7 additions & 6 deletions json_schemas/test_story.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ definitions:
items:
type: integer

HttpMethod:
type: string
# eslint-disable-next-line yml/sort-sequence-values
enum: [GET, PUT, POST, DELETE, PATCH, HEAD, OPTIONS]

ChapterRequest:
type: object
properties:
Expand All @@ -79,12 +84,8 @@ definitions:
oneOf:
- type: array
items:
type: string
# eslint-disable-next-line yml/sort-sequence-values
enum: [GET, PUT, POST, DELETE, PATCH, HEAD, OPTIONS]
- type: string
# eslint-disable-next-line yml/sort-sequence-values
enum: [GET, PUT, POST, DELETE, PATCH, HEAD, OPTIONS]
$ref: '#/definitions/HttpMethod'
- $ref: '#/definitions/HttpMethod'
parameters:
type: object
additionalProperties:
Expand Down
9 changes: 6 additions & 3 deletions tools/src/tester/types/story.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export type SupplementalChapter = ChapterRequest & {
*/
status?: number[];
};
/**
* This interface was referenced by `Story`'s JSON-Schema
* via the `definition` "HttpMethod".
*/
export type HttpMethod = 'GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
/**
* This interface was referenced by `Story`'s JSON-Schema
* via the `definition` "Parameter".
Expand Down Expand Up @@ -115,9 +120,7 @@ export interface ChapterRequest {
*/
id?: string;
path: string;
method:
| ('GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS')[]
| ('GET' | 'PUT' | 'POST' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS');
method: HttpMethod[] | HttpMethod;
parameters?: {
[k: string]: Parameter;
};
Expand Down

0 comments on commit 958c971

Please sign in to comment.