@kravc/dos 1.4.11 → 1.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kravc/dos",
3
- "version": "1.4.11",
3
+ "version": "1.4.12",
4
4
  "description": "Convention-based, easy-to-use library for building API-driven serverless services.",
5
5
  "keywords": [
6
6
  "Service",
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const omit = require('lodash.omit')
4
+ const uniq = require('lodash.uniq')
4
5
  const ZSchema = require('z-schema')
5
6
  const { parse } = require('url')
6
7
  const jsonSchema = require('../../assets/schemas/oas2.json')
@@ -50,6 +51,7 @@ const createSpec = (operations, schemasMap, url) => {
50
51
  }
51
52
  }
52
53
 
54
+ let serviceTags = []
53
55
  for (const Operation of operations) {
54
56
  const httpPath = `/${Operation.id}`
55
57
  const httpMethod = getHttpMethod(Operation)
@@ -66,6 +68,8 @@ const createSpec = (operations, schemasMap, url) => {
66
68
  mutationSchema
67
69
  } = Operation
68
70
 
71
+ serviceTags = serviceTags.concat(tags)
72
+
69
73
  const operationSpec = {
70
74
  tags,
71
75
  summary,
@@ -154,6 +158,10 @@ const createSpec = (operations, schemasMap, url) => {
154
158
  spec.paths[httpPath] = { [httpMethod]: operationSpec }
155
159
  }
156
160
 
161
+ serviceTags = uniq(serviceTags)
162
+ serviceTags.sort((a, b) => a.localeCompare(b))
163
+ spec.tags = serviceTags.map(name => ({ name }))
164
+
157
165
  const json = JSON
158
166
  .stringify(spec, null, 2)
159
167
  .replace(/"\$ref": "/g, '"$ref": "#/definitions/')