Skip to content

Commit 8881ecd

Browse files
committed
feat: 🎉 initialize project
0 parents  commit 8881ecd

File tree

11 files changed

+8355
-0
lines changed

11 files changed

+8355
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/node_modules
2+
**/dist
3+
**/.DS_Store

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"stoplight.spectral"
4+
]
5+
}

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"javascript.preferences.importModuleSpecifierEnding": "js",
3+
"typescript.preferences.importModuleSpecifierEnding": "js",
4+
"spectral.rulesetFile": "docs/.spectral.yaml",
5+
}

docs/.spectral.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
extends: "spectral:oas"
2+
rules:
3+
examples-mandatory-on-primitive-objects:
4+
severity: error
5+
description: |
6+
This rule ensures that all primitive types have an example value.
7+
given: $..[?(@.type == 'string' || @.type == 'number' || @.type == 'integer' || @.type == 'boolean' || @.type == 'null')]
8+
then:
9+
field: example
10+
function: truthy
11+
no-examples-on-non-primitives-objects:
12+
severity: error
13+
description: |
14+
This rule ensures that non primitive types do not have an example value.
15+
given: $..[?(@.type == 'object' || @.type == 'array')]
16+
then:
17+
field: example
18+
function: falsy

docs/openapi-spec.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
openapi: 3.0.3
2+
info:
3+
title: Simple fastify API
4+
description: A simple API built with Fastify.
5+
version: '0.0.0'
6+
contact:
7+
email: lebas.axel@gmail.com
8+
servers:
9+
- url: 'http://localhost:8080'
10+
description: Local
11+
tags:
12+
- name: health
13+
description: API Health checks
14+
paths:
15+
/health:
16+
get:
17+
summary: Health check
18+
description: Check the health of the API.
19+
operationId: health
20+
tags:
21+
- health
22+
responses:
23+
'200':
24+
description: OK
25+
content:
26+
application/json:
27+
schema:
28+
$ref: '#/components/schemas/Health'
29+
components:
30+
schemas:
31+
Health:
32+
type: object
33+
properties:
34+
status:
35+
type: string
36+
example: ok
37+
description: The status of the API
38+
enum:
39+
- ok
40+
uptime:
41+
type: integer
42+
format: int64
43+
description: The uptime of the API in seconds
44+
example: 60
45+
required:
46+
- status
47+
- uptime

0 commit comments

Comments
 (0)