Skip to content

Commit

Permalink
Merge pull request #7 from signadot/openapi-doc
Browse files Browse the repository at this point in the history
Auto generated documentation for the HTTP API
  • Loading branch information
daniel-de-vera authored Jan 4, 2024
2 parents 16a24e8 + bacd931 commit 01e277a
Show file tree
Hide file tree
Showing 6 changed files with 439 additions and 17 deletions.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
UID := $(shell id -u)
GID := $(shell id -g)

generate-openapi-doc:
docker run --rm \
-u ${UID}:${GID} \
-v ${PWD}:/local \
redocly/cli build-docs \
-o /local/docs/http-api/index.html \
/local/routes-openapi.yaml

400 changes: 400 additions & 0 deletions docs/http-api/index.html

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url='https://github.com/signadot/routesapi'" />
</head>
</html>
2 changes: 1 addition & 1 deletion go-routesapi/models/model_workload_route.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go-routesapi/models/model_workload_routes_response.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 20 additions & 15 deletions routes-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ info:
description: >
The Routes API provides access to in-cluster routing
configuration set up by the Signadot Operator.
contact:
url: https://github.com/signadot/routesapi
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
- url: http://routeserver.signadot.svc:7778
paths:
Expand Down Expand Up @@ -65,49 +70,49 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/workloadRoutesResponse'
$ref: '#/components/schemas/WorkloadRoutesResponse'
components:
schemas:
workloadRoutesResponse:
WorkloadRoutesResponse:
type: object
description: |-
A workloadRoutesResponse gives the set of WorkloadRoutes which match a
A WorkloadRoutesResponse gives the set of WorkloadRoutes which match a
given GetWorkloadRoutes request
properties:
routes:
type: array
items:
$ref: '#/components/schemas/workloadRoute'
$ref: '#/components/schemas/WorkloadRoute'

workloadRoute:
WorkloadRoute:
type: object
description: |-
A WorkloadRoute defines for a given baseline and a routing key, a single
`destinationSandbox` and `mappings`. The mappings map each port of the
`DestinationSandbox` and `mappings`. The mappings map each port of the
baseline workload with corresponding TCP addresses belonging to the
`destinationSandbox` where traffic is routed instead.
`DestinationSandbox` where traffic is routed instead.
properties:
routingKey:
type: string
description: The routing key
example: 4835rlwxwbwyl
baseline:
$ref: '#/components/schemas/baselineWorkload'
$ref: '#/components/schemas/BaselineWorkload'
description: The corresponding baseline workload
destinationSandbox:
$ref: '#/components/schemas/destinationSandbox'
$ref: '#/components/schemas/DestinationSandbox'
description: The sandbox associated with the destination sandboxed workloads.
mappings:
description: A mapping from a port on the workload to a set of destinations.
type: array
items:
$ref: '#/components/schemas/workloadPortMapping'
$ref: '#/components/schemas/WorkloadPortMapping'
required:
- routingKey
- baseline
- destinationSandbox

destinationSandbox:
DestinationSandbox:
type: object
description: |-
A DestinationSandbox represents a sandbox that will receive traffic
Expand All @@ -120,7 +125,7 @@ components:
required:
- name

baselineWorkload:
BaselineWorkload:
type: object
description: |-
A BaselineWorkload identifies a given baseline workload.
Expand All @@ -142,7 +147,7 @@ components:
- namespace
- name

workloadPortMapping:
WorkloadPortMapping:
type: object
description: |-
A WorkloadPortMapping provides a mapping from a port on the workload to
Expand All @@ -157,11 +162,11 @@ components:
destinations:
type: array
items:
$ref: '#/components/schemas/location'
$ref: '#/components/schemas/Location'
required:
- workloadPort

location:
Location:
type: object
description: |-
A TCP address as a host, port pair.
Expand Down

0 comments on commit 01e277a

Please sign in to comment.