Skip to content

Commit

Permalink
upd openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
ikethecoder committed Jun 1, 2021
1 parent 44fdd93 commit 9cedfb2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/api-openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class ApiOpenapiApp {

RegisterRoutes(app);

// RFC 8631 service-desc link relation
// https://datatracker.ietf.org/doc/html/rfc8631
app.get('/ds/api', (req, res) => {
res.setHeader('Link', '</ds/api/openapi.yaml>; rel="service-desc"');
res.status(204).end();
});

app.get('/ds/api/openapi.yaml', (req, res) => {
res.setHeader('Content-Type', 'application/yaml');
res.send(spec);
Expand Down
1 change: 1 addition & 0 deletions src/controllers/ContentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import multer from 'multer';
import { DateTime, Markdown } from '@keystonejs/fields';

interface Content {
kind?: string;
externalLink: string;
title?: string;
description?: string;
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ components:
schemas:
Content:
properties:
kind:
type: string
externalLink:
type: string
title:
Expand Down
1 change: 1 addition & 0 deletions src/controllers/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const models: TsoaRoute.Models = {
"Content": {
"dataType": "refObject",
"properties": {
"kind": {"dataType":"string"},
"externalLink": {"dataType":"string","required":true},
"title": {"dataType":"string"},
"description": {"dataType":"string"},
Expand Down

0 comments on commit 9cedfb2

Please sign in to comment.