{"_id":"@brokkr/open-api-endpoint","_rev":"2-18da4944aea212a2d559f29f6f4a8c1a","name":"@brokkr/open-api-endpoint","dist-tags":{"latest":"0.15.2"},"versions":{"0.15.0":{"name":"@brokkr/open-api-endpoint","version":"0.15.0","author":{"url":"https://gurunars.com","name":"Anton Berezin","email":"gurunars@gmail.com"},"license":"Apache-2.0","_id":"@brokkr/open-api-endpoint@0.15.0","maintainers":[{"name":"gurunars","email":"gurunars@gmail.com"}],"homepage":"https://github.com/spec-validator/validator","bugs":{"url":"https://github.com/spec-validator/validator/issues"},"dist":{"shasum":"0629362b859a8feb3dc1856dc5717cec8da0b8d6","tarball":"https://registry.npmjs.org/@brokkr/open-api-endpoint/-/open-api-endpoint-0.15.0.tgz","fileCount":18,"integrity":"sha512-FxvxjliRV1tIp/OhZ6jvU3JLshCIiB8nne6s5DlYq0APnLo5Wujs9L0oZ80B8ByMlCEuOGB60UEStuUq86aSvA==","signatures":[{"sig":"MEQCIBFsOpTlSCaacchOJLs5Al6W543n+0B3o6nybRRzBhgtAiBg8ypV+l/Lx02L2oGADy/D/84iFw6vD9UfTiJb1MQM9A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34742},"private":false,"_npmUser":{"name":"gurunars","email":"gurunars@gmail.com"},"repository":{"url":"https://github.com/spec-validator/validator.git","type":"git"},"description":"The endpoint decorates server configs with an additional set of routes that generate open-api spec and a ui for it.","directories":{},"dependencies":{"@brokkr/utils":"0.15.0","openapi-types":"12.1.3","@brokkr/validator":"0.15.0","@brokkr/rest-api-server":"0.15.0"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/open-api-endpoint_0.15.0_1735549842734_0.6102674161701407","host":"s3://npm-registry-packages-npm-production"}},"0.15.1":{"name":"@brokkr/open-api-endpoint","version":"0.15.1","author":{"url":"https://gurunars.com","name":"Anton Berezin","email":"gurunars@gmail.com"},"license":"Apache-2.0","_id":"@brokkr/open-api-endpoint@0.15.1","maintainers":[{"name":"gurunars","email":"gurunars@gmail.com"}],"homepage":"https://github.com/brokkr/validator","bugs":{"url":"https://github.com/brokkr/validator/issues"},"dist":{"shasum":"818c57378b46d12869d0b14b3ee9510e35b0983c","tarball":"https://registry.npmjs.org/@brokkr/open-api-endpoint/-/open-api-endpoint-0.15.1.tgz","fileCount":18,"integrity":"sha512-B3GXlQc6+CidhjnWWWeWWEu3OjGW2diBSSG04P0MHogec9oPAy0zh4HYnow9rvDFkUVGga841AU5U1S0LSMoUQ==","signatures":[{"sig":"MEUCIQCVGhFlU0ylQ8qI4Vp16XjBYgis/73Uo+XdrxdzONEW5QIgBPuiS+NkxpCkA4UK/M4jXKWLYP0dLD1jPAO/utDYxIY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":34718},"private":false,"_npmUser":{"name":"gurunars","email":"gurunars@gmail.com"},"repository":{"url":"https://github.com/brokkr/validator.git","type":"git"},"description":"The endpoint decorates server configs with an additional set of routes that generate open-api spec and a ui for it.","directories":{},"dependencies":{"@brokkr/utils":"0.15.1","openapi-types":"12.1.3","@brokkr/validator":"0.15.1","@brokkr/rest-api-server":"0.15.1"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/open-api-endpoint_0.15.1_1735556564158_0.7935631685523035","host":"s3://npm-registry-packages-npm-production"}},"0.15.2":{"name":"@brokkr/open-api-endpoint","license":"Apache-2.0","version":"0.15.2","dependencies":{"@brokkr/rest-api-server":"0.15.2","@brokkr/utils":"0.15.2","@brokkr/validator":"0.15.2","openapi-types":"12.1.3"},"author":{"name":"Anton Berezin","email":"gurunars@gmail.com","url":"https://gurunars.com"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"repository":{"url":"https://github.com/brokkr/validator.git","type":"git"},"bugs":{"url":"https://github.com/brokkr/validator/issues"},"homepage":"https://github.com/brokkr/validator","private":false,"description":"The endpoint decorates server configs with an additional set of routes that generate open-api spec and a ui for it.","_id":"@brokkr/open-api-endpoint@0.15.2","dist":{"shasum":"52c46925cb0ca53da9feffaf5d9ccb3a5af4d271","integrity":"sha512-cOzX5UUuwH/9zslkMqWatoqFk8BjQMXxtGxHb6hvt3zuNq0kHgQkEzfs6gdBr2tBLCkTgzOTUkRnqM8xLolakg==","tarball":"https://registry.npmjs.org/@brokkr/open-api-endpoint/-/open-api-endpoint-0.15.2.tgz","fileCount":18,"unpackedSize":34744,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChWJQ9DSSnI9OnY85MRtziAUbQoAyeZiK9sTQtpCfdoQIhAMIVLuFwoTft1zqM6NOIBtujZ1l3kyDH5TxmhzFrZNlp"}]},"_npmUser":{"name":"gurunars","email":"gurunars@gmail.com"},"directories":{},"maintainers":[{"name":"gurunars","email":"gurunars@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/open-api-endpoint_0.15.2_1735643501486_0.9738716159208067"},"_hasShrinkwrap":false}},"time":{"created":"2024-12-30T09:10:42.597Z","modified":"2024-12-31T11:11:41.888Z","0.15.0":"2024-12-30T09:10:42.913Z","0.15.1":"2024-12-30T11:02:44.333Z","0.15.2":"2024-12-31T11:11:41.664Z"},"bugs":{"url":"https://github.com/brokkr/validator/issues"},"author":{"name":"Anton Berezin","email":"gurunars@gmail.com","url":"https://gurunars.com"},"license":"Apache-2.0","homepage":"https://github.com/brokkr/validator","repository":{"url":"https://github.com/brokkr/validator.git","type":"git"},"description":"The endpoint decorates server configs with an additional set of routes that generate open-api spec and a ui for it.","maintainers":[{"name":"gurunars","email":"gurunars@gmail.com"}],"readme":"# @brokkr/open-api-endpoint\n\nThe endpoint decorates server configs with an additional set of\nroutes that generate open-api spec and a ui for it.\n\n```ts\nimport http from 'http'\n\nimport { createServer, _ } from '@brokkr/rest-api-server'\nimport { segmentField as $, numberField, stringField } from '@brokkr/validator/fields'\nimport { withOpenApi } from '@brokkr/open-api-endpoint'\nimport { expectType } from '@brokkr/test-utils/expectType'\n\nconst itemSpec = {\n  title: stringField(),\n  description: stringField(),\n}\n\nconst server = createServer(withOpenApi({\n  routes: [\n    _.POST($._('/items'))\n      .body(itemSpec)\n      ._resp_\n      .body(numberField())\n      .headers({\n        title: stringField(),\n      }).handler(async () => ({\n        body: 42,\n        headers: {\n          title: 'Foo',\n        },\n      })),\n    _.GET($._('/items'))._resp_.body(\n      [itemSpec],\n    ).handler(\n      async () => ({\n        body: [\n          {\n            title: 'Item N',\n            description: 'Description',\n          },\n        ],\n      }),\n    )\n  ]\n}))\n\nexpectType<http.Server & { serve: () => http.Server }, typeof server>(true)\n```\n\nOnce served via a regular call:\n\n```ts #ignore\nserver.serve()\n```\n\nOpenApi ui will be available at <http://localhost:8000/open-api-ui>\nwithout any additional effort.\n","readmeFilename":"README.md"}