@travetto/openapi 3.1.4 → 3.1.5

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": "@travetto/openapi",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "OpenAPI integration support for the Travetto framework",
5
5
  "keywords": [
6
6
  "rest",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@travetto/config": "^3.1.2",
30
- "@travetto/rest": "^3.1.2",
30
+ "@travetto/rest": "^3.1.3",
31
31
  "@travetto/schema": "^3.1.2",
32
32
  "@travetto/yaml": "^3.1.1",
33
33
  "openapi3-ts": "^3.1.2"
package/src/controller.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Controller, Get, SetHeaders } from '@travetto/rest';
1
+ import { Controller, Get, SetHeaders, Undocumented } from '@travetto/rest';
2
2
  import { Inject } from '@travetto/di';
3
3
  import { YamlUtil } from '@travetto/yaml';
4
4
 
@@ -7,6 +7,7 @@ import { OpenApiService } from './service';
7
7
  /**
8
8
  * Basic controller for surfacing the api spec
9
9
  */
10
+ @Undocumented()
10
11
  @Controller('/')
11
12
  export class OpenApiController {
12
13
 
@@ -11,7 +11,6 @@ import { SchemaRegistry, FieldConfig } from '@travetto/schema';
11
11
  import { AllViewⲐ } from '@travetto/schema/src/internal/types';
12
12
 
13
13
  import { ApiSpecConfig } from './config';
14
- import { OpenApiController } from './controller';
15
14
 
16
15
  const DEFINITION = '#/components/schemas';
17
16
 
@@ -354,29 +353,20 @@ export class SpecGenerator {
354
353
  };
355
354
  }
356
355
 
357
- /**
358
- * Process each controller
359
- */
360
- processController(cls: Class): void {
361
- const ctrl = ControllerRegistry.get(cls);
362
-
363
- this.#tags.push({
364
- name: this.#getTypeTag(ctrl.class),
365
- description: ctrl.description || ctrl.title
366
- });
367
-
368
- for (const ep of ctrl.endpoints) {
369
- this.processEndpoint(ctrl, ep);
370
- }
371
- }
372
-
373
356
  /**
374
357
  * Generate full specification
375
358
  */
376
359
  generate(config: Partial<ApiSpecConfig> = {}): GeneratedSpec {
377
360
 
378
361
  for (const cls of ControllerRegistry.getClasses()) {
379
- for (const ep of ControllerRegistry.get(cls).endpoints) {
362
+ const controller = ControllerRegistry.get(cls);
363
+ if (controller.documented === false) {
364
+ continue;
365
+ }
366
+ for (const ep of controller.endpoints) {
367
+ if (ep.documented === false) {
368
+ continue;
369
+ }
380
370
  if (ep.requestType) {
381
371
  this.#processSchema(ep.requestType.type);
382
372
  }
@@ -391,8 +381,20 @@ export class SpecGenerator {
391
381
 
392
382
  if (!config.skipRoutes) {
393
383
  for (const cls of ControllerRegistry.getClasses()) {
394
- if (cls.Ⲑid !== OpenApiController.Ⲑid) {
395
- this.processController(cls);
384
+ const controller = ControllerRegistry.get(cls);
385
+ if (controller.documented === false) {
386
+ continue;
387
+ }
388
+ this.#tags.push({
389
+ name: this.#getTypeTag(controller.class),
390
+ description: controller.description || controller.title
391
+ });
392
+
393
+ for (const ep of controller.endpoints) {
394
+ if (ep.documented === false) {
395
+ continue;
396
+ }
397
+ this.processEndpoint(controller, ep);
396
398
  }
397
399
  }
398
400
  }