Browse Source

Add swagger doc and build HTML from it.

feature/search
Bèr Kessels 1 year ago
parent
commit
ab17dc2923
5 changed files with 719 additions and 9 deletions
  1. 2
    1
      .gitignore
  2. 1
    0
      Makefile
  3. 78
    0
      doc/swagger.yml
  4. 1
    0
      package.json
  5. 637
    8
      yarn.lock

+ 2
- 1
.gitignore View File

@@ -5,4 +5,5 @@
node_modules/

# Ignore generated documentation
doc/
doc/*
!doc/swagger.yml

+ 1
- 0
Makefile View File

@@ -47,3 +47,4 @@ lint:

doc:
npx documentation build **.js -f html -o doc
npx redoc-cli bundle doc/swagger.yml --output doc/api.html

+ 78
- 0
doc/swagger.yml View File

@@ -0,0 +1,78 @@
openapi: 3.0.0
info:
title: Hours RESTful API for opening hours
version: 0.0.0
paths:
/places/{id}:
get:
operationId: getPlaceById
parameters:
- id: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: The Place
content:
application/json:
schema:
$ref: '#/components/schemas/place'
links:
$ref: '#/components/links/PlaceLinks'
components:
links:
PlaceLinks:
# returns array of '#/components/schemas/repository'
operationId: getPlaceById
parameters:
id: $response.body#/id
schemas:
place:
type: object
properties:
id:
type: integer
raw_opening_hours:
type: string
description: The opening hours string as found in Open Street Map
address:
type: object
properties:
street:
type: string
housenumber:
type: string
postcode:
type: string
city:
type: string
country_code:
type: string
name:
type: string
description: the name of the place, if given.
open_this_week:
type: array
items:
- properties:
from:
type: String
description: Datetime when this slot starts
to:
type: String
description: Datetime when this slot ends
unknown:
type: boolean
description: "true when it is not certain this slot is open."
comment:
type: string
description: "additional comment. Often explaining why it is unknown"
status:
type: boolean
description: "true when open now, false when closed now"
week_stable:
type: boolean
description: "true when the opening_hours will change next week(s)"


+ 1
- 0
package.json View File

@@ -19,6 +19,7 @@
"opening_hours": "^3.5.0",
"pg": "^7.7.1",
"pg-hstore": "^2.3.2",
"redoc-cli": "^0.7.0",
"sequelize": "^4.41.2",
"sinon": "^7.1.1",
"standard": "^12.0.1"

+ 637
- 8
yarn.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save