-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
214 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,160 @@ | ||
components: | ||
schemas: | ||
ErrorDetail: | ||
additionalProperties: false | ||
properties: | ||
location: | ||
description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id' | ||
type: string | ||
message: | ||
description: Error message text | ||
type: string | ||
value: | ||
description: The value at the given location | ||
type: object | ||
ErrorModel: | ||
additionalProperties: false | ||
properties: | ||
$schema: | ||
description: A URL to the JSON Schema for this object. | ||
examples: | ||
- http://localhost:6500/api/v1/schemas/ErrorModel.json | ||
format: uri | ||
readOnly: true | ||
type: string | ||
detail: | ||
description: A human-readable explanation specific to this occurrence of the problem. | ||
examples: | ||
- Property foo is required but is missing. | ||
type: string | ||
errors: | ||
description: Optional list of individual error details | ||
items: | ||
$ref: "#/components/schemas/ErrorDetail" | ||
type: array | ||
instance: | ||
description: A URI reference that identifies the specific occurrence of the problem. | ||
examples: | ||
- https://example.com/error-log/abc123 | ||
format: uri | ||
type: string | ||
status: | ||
description: HTTP status code | ||
examples: | ||
- 400 | ||
format: int64 | ||
type: integer | ||
title: | ||
description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error. | ||
examples: | ||
- Bad Request | ||
type: string | ||
type: | ||
default: about:blank | ||
description: A URI reference to human-readable documentation for the error. | ||
examples: | ||
- https://example.com/errors/example | ||
format: uri | ||
type: string | ||
type: object | ||
GreetingOutput3Body: | ||
additionalProperties: false | ||
properties: | ||
$schema: | ||
description: A URL to the JSON Schema for this object. | ||
examples: | ||
- http://localhost:6500/api/v1/schemas/GreetingOutput3Body.json | ||
format: uri | ||
readOnly: true | ||
type: string | ||
message: | ||
description: Greeting message | ||
examples: | ||
- Hello, world! | ||
type: string | ||
required: | ||
- message | ||
type: object | ||
HealthCheckParams2Body: | ||
additionalProperties: false | ||
properties: | ||
$schema: | ||
description: A URL to the JSON Schema for this object. | ||
examples: | ||
- http://localhost:6500/api/v1/schemas/HealthCheckParams2Body.json | ||
format: uri | ||
readOnly: true | ||
type: string | ||
message: | ||
description: Greeting message | ||
examples: | ||
- Hello, world! | ||
type: string | ||
required: | ||
- message | ||
type: object | ||
securitySchemes: | ||
bearer: | ||
bearerFormat: JWT | ||
scheme: bearer | ||
type: http | ||
info: | ||
title: TinyURL | ||
version: 1.0.0 | ||
openapi: 3.1.0 | ||
paths: | ||
/greeting/{name}: | ||
get: | ||
description: Get a greeting for a person by name. | ||
operationId: get-greeting | ||
parameters: | ||
- description: Name to greet | ||
example: world | ||
in: path | ||
name: name | ||
required: true | ||
schema: | ||
description: Name to greet | ||
examples: | ||
- world | ||
maxLength: 30 | ||
type: string | ||
responses: | ||
"200": | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/GreetingOutput3Body" | ||
description: OK | ||
default: | ||
content: | ||
application/problem+json: | ||
schema: | ||
$ref: "#/components/schemas/ErrorModel" | ||
description: Error | ||
summary: Get a greeting | ||
tags: | ||
- Greetings | ||
/health: | ||
get: | ||
description: Check the health of the service. | ||
operationId: health | ||
responses: | ||
"200": | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/HealthCheckParams2Body" | ||
description: OK | ||
default: | ||
content: | ||
application/problem+json: | ||
schema: | ||
$ref: "#/components/schemas/ErrorModel" | ||
description: Error | ||
summary: Health Check | ||
tags: | ||
- Greetings | ||
servers: | ||
- url: http://localhost:6500/api/v1 | ||
|
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package configs | ||
|
||
const ( | ||
ApplicationPort = ":6500" | ||
OpenAPITitle = "TinyURL" | ||
OpenAPIVersion = "1.0.0" | ||
ApplicationPort = ":6500" | ||
OpenAPITitle = "TinyURL API" | ||
OpenAPIVersion = "1.0.0" | ||
OpenAPIServerPath = "http://localhost:6500/api/v1" | ||
) |
This file contains 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