-
Notifications
You must be signed in to change notification settings - Fork 0
Add happy path examples and Links to OpenAPI documentation #128
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
Open
Copilot
wants to merge
2
commits into
main
Choose a base branch
from
copilot/fix-127
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,48 @@ paths: | |
nullable: true | ||
hasMore: | ||
type: boolean | ||
examples: | ||
lamps_list: | ||
summary: List of lamps | ||
description: Example response showing multiple lamps with pagination | ||
value: | ||
data: | ||
- id: "046b6c7f-0b8a-43b9-b35d-6489e6daee91" | ||
status: true | ||
createdAt: "2024-01-15T09:30:00Z" | ||
updatedAt: "2024-01-15T14:22:30Z" | ||
- id: "7c9e2a5b-8f1d-4e3c-9b2a-1d5f8c7e4b6a" | ||
status: false | ||
createdAt: "2024-01-15T10:15:45Z" | ||
updatedAt: "2024-01-15T10:15:45Z" | ||
nextCursor: "eyJpZCI6IjdjOWUyYTViLThmMWQtNGUzYy05YjJhLTFkNWY4YzdlNGI2YSJ9" | ||
hasMore: true | ||
empty_list: | ||
summary: Empty list of lamps | ||
description: Example response when no lamps exist | ||
value: | ||
data: [] | ||
nextCursor: null | ||
hasMore: false | ||
links: | ||
GetLampById: | ||
operationId: getLamp | ||
parameters: | ||
lampId: '$response.body#/data/0/id' | ||
description: > | ||
The `id` value of any lamp in the list can be used as the `lampId` parameter in `GET /lamps/{lampId}`. | ||
UpdateLamp: | ||
operationId: updateLamp | ||
parameters: | ||
lampId: '$response.body#/data/0/id' | ||
description: > | ||
The `id` value of any lamp in the list can be used as the `lampId` parameter in `PUT /lamps/{lampId}`. | ||
DeleteLamp: | ||
operationId: deleteLamp | ||
parameters: | ||
lampId: '$response.body#/data/0/id' | ||
description: > | ||
The `id` value of any lamp in the list can be used as the `lampId` parameter in `DELETE /lamps/{lampId}`. | ||
'304': | ||
description: Not Modified | ||
post: | ||
|
@@ -48,13 +90,60 @@ paths: | |
application/json: | ||
schema: | ||
$ref: '#/components/schemas/LampCreate' | ||
examples: | ||
create_lamp_on: | ||
summary: Create lamp that is turned on | ||
description: Create a new lamp with status set to on/true | ||
value: | ||
status: true | ||
create_lamp_off: | ||
summary: Create lamp that is turned off | ||
description: Create a new lamp with status set to off/false | ||
value: | ||
status: false | ||
responses: | ||
'201': | ||
description: Lamp created successfully | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Lamp' | ||
examples: | ||
created_lamp_on: | ||
summary: Created lamp turned on | ||
description: Successfully created lamp with status on | ||
value: | ||
id: "046b6c7f-0b8a-43b9-b35d-6489e6daee91" | ||
status: true | ||
createdAt: "2024-01-15T09:30:00Z" | ||
updatedAt: "2024-01-15T09:30:00Z" | ||
created_lamp_off: | ||
summary: Created lamp turned off | ||
description: Successfully created lamp with status off | ||
value: | ||
id: "7c9e2a5b-8f1d-4e3c-9b2a-1d5f8c7e4b6a" | ||
status: false | ||
createdAt: "2024-01-15T10:15:45Z" | ||
updatedAt: "2024-01-15T10:15:45Z" | ||
links: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The links section is incorrectly indented. It should be at the same level as the response content, not nested within the 201 response. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
GetLampById: | ||
operationId: getLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used as the `lampId` parameter in `GET /lamps/{lampId}`. | ||
UpdateLamp: | ||
operationId: updateLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used as the `lampId` parameter in `PUT /lamps/{lampId}`. | ||
DeleteLamp: | ||
operationId: deleteLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used as the `lampId` parameter in `DELETE /lamps/{lampId}`. | ||
'400': | ||
description: Invalid request data | ||
content: | ||
|
@@ -83,6 +172,36 @@ paths: | |
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Lamp' | ||
examples: | ||
lamp_on: | ||
summary: Lamp that is turned on | ||
description: Example of a lamp with status on/true | ||
value: | ||
id: "046b6c7f-0b8a-43b9-b35d-6489e6daee91" | ||
status: true | ||
createdAt: "2024-01-15T09:30:00Z" | ||
updatedAt: "2024-01-15T14:22:30Z" | ||
lamp_off: | ||
summary: Lamp that is turned off | ||
description: Example of a lamp with status off/false | ||
value: | ||
id: "7c9e2a5b-8f1d-4e3c-9b2a-1d5f8c7e4b6a" | ||
status: false | ||
createdAt: "2024-01-15T10:15:45Z" | ||
updatedAt: "2024-01-15T10:15:45Z" | ||
links: | ||
UpdateLamp: | ||
operationId: updateLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used to update the lamp using `PUT /lamps/{lampId}`. | ||
DeleteLamp: | ||
operationId: deleteLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used to delete the lamp using `DELETE /lamps/{lampId}`. | ||
'304': | ||
description: Not Modified | ||
'400': | ||
|
@@ -112,13 +231,54 @@ paths: | |
application/json: | ||
schema: | ||
$ref: '#/components/schemas/LampUpdate' | ||
examples: | ||
turn_on: | ||
summary: Turn lamp on | ||
description: Update lamp status to on/true | ||
value: | ||
status: true | ||
turn_off: | ||
summary: Turn lamp off | ||
description: Update lamp status to off/false | ||
value: | ||
status: false | ||
responses: | ||
'200': | ||
description: Lamp updated successfully | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Lamp' | ||
examples: | ||
updated_to_on: | ||
summary: Lamp turned on | ||
description: Lamp successfully updated to on status | ||
value: | ||
id: "046b6c7f-0b8a-43b9-b35d-6489e6daee91" | ||
status: true | ||
createdAt: "2024-01-15T09:30:00Z" | ||
updatedAt: "2024-01-15T16:45:20Z" | ||
updated_to_off: | ||
summary: Lamp turned off | ||
description: Lamp successfully updated to off status | ||
value: | ||
id: "046b6c7f-0b8a-43b9-b35d-6489e6daee91" | ||
status: false | ||
createdAt: "2024-01-15T09:30:00Z" | ||
updatedAt: "2024-01-15T16:45:20Z" | ||
links: | ||
GetLampById: | ||
operationId: getLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used to get the updated lamp details using `GET /lamps/{lampId}`. | ||
DeleteLamp: | ||
operationId: deleteLamp | ||
parameters: | ||
lampId: '$response.body#/id' | ||
description: > | ||
The `id` value returned in the response can be used to delete the lamp using `DELETE /lamps/{lampId}`. | ||
'400': | ||
description: Invalid request data or lamp ID format | ||
content: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The examples are placed at the wrong level in the YAML structure. They should be nested under the media type (application/json) rather than at the requestBody level.
Copilot uses AI. Check for mistakes.