{"id":13615703,"url":"https://github.com/noflo/noflo-swagger-client","last_synced_at":"2025-04-13T03:07:38.161Z","repository":{"id":37954392,"uuid":"293841775","full_name":"noflo/noflo-swagger-client","owner":"noflo","description":"Generate NoFlo components for accessing a Swagger/OpenAPI service","archived":false,"fork":false,"pushed_at":"2023-01-16T19:01:52.000Z","size":91,"stargazers_count":2,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T03:07:16.759Z","etag":null,"topics":["noflo-components","openapi","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/noflo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-08T14:52:30.000Z","updated_at":"2022-02-20T05:30:39.000Z","dependencies_parsed_at":"2023-02-10T05:45:36.171Z","dependency_job_id":null,"html_url":"https://github.com/noflo/noflo-swagger-client","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-swagger-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-swagger-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-swagger-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noflo%2Fnoflo-swagger-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noflo","download_url":"https://codeload.github.com/noflo/noflo-swagger-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248657917,"owners_count":21140846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["noflo-components","openapi","swagger"],"created_at":"2024-08-01T20:01:16.873Z","updated_at":"2025-04-13T03:07:38.138Z","avatar_url":"https://github.com/noflo.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"noflo-swagger-client\n====================\n\nThis library can be used for generating NoFlo components for accessing any REST API described by [Swagger/OpenAPI](https://swagger.io). Each API method will get its own component, with the top-level parameters becoming separate inports.\n\n## Declarative usage\n\nIn Node.js NoFlo projects it is possible to register Swagger files for component generation by declaring them in your `package.json`. Example:\n\n```json\n{\n  \"version\": \"...\",\n  \"dependencies\": {\n    ...\n  },\n  \"noflo\": {\n    \"swagger\": {\n      \"petstore\": {\n        \"url\": \"https://petstore3.swagger.io/api/v3/openapi.json\"\n      }\n    }\n  }\n}\n```\n\nThis would generate a component for each [Swagger pet store](https://petstore3.swagger.io/) method using the `petstore` namespace. So you'd get components like `petstore/FindPetByID`.\n\n## Usage as a library\n\nIt is also possible to use noflo-swagger-client as a library, registering NoFlo components programmatically. This is useful for example when utilizing [noflo-nodejs as a library](https://github.com/noflo/noflo-nodejs#embedding-runtime-in-an-existing-service).\n\n```javascript\nconst loader = new noflo.ComponentLoader(process.cwd());\nconst def = {\n  url: 'http://petstore.swagger.io/v2/swagger.json',\n};\nloader.listComponents(() =\u003e {\n  registerSwaggerComponents(loader, 'petstore', def))\n    .then(() =\u003e {\n      console.log('Components registered!');\n    });\n});\n```\n\n## Assembly line components\n\nThis library can also create [NoFlo Assembly Line](https://github.com/noflo/noflo-assembly/wiki) compatible components. Just add `assembly: true` to the API definition parameters.\n\nIn `package.json`:\n\n```json\n{\n  \"dependencies\": {\n    ...\n  },\n  \"noflo\": {\n    \"swagger\": {\n      \"petstore\": {\n        \"url\": \"https://petstore3.swagger.io/api/v3/openapi.json\",\n        \"assembly\": true\n      }\n    }\n  }\n}\n```\n\nThese components will only contain `in` and `out` ports. The key `parameter` of the input message will be used as request parameters, and the API response will be written as the message parameter `response`. Error handling is handled using the [noflo-assembly conventions](https://github.com/noflo/noflo-assembly/wiki/Error-handling).\n\n## Populating authorization data from environment variables\n\nIn addition to [registering authorization keys](https://github.com/swagger-api/swagger-js/blob/2b950ee77f814069b9f1d92a422eeb56c47ac2b5/docs/migration/migration-2-x-to-3-x.md#authorizations) via the API definition passed to NoFlo Swagger Client initially, it can also be done via environment variables. This is especially useful when generating the components in the declarative way.\n\nThe environment variables supported are formatted with `SWAGGER_\u003cNAMESPACE\u003e_\u003cKEYNAME\u003e`.\nFor example to populate the API key to the pet store API used as example above, you'd set it with `SWAGGER_PETSTORE_APIKEY`. With this, all components needing API key authentication will set the `api_key` header to the value from the environment variable.\n\n## Loading Swagger definitions from the file system\n\nBy default the Swagger definitions are requested from their supplied URL. It is however possible to pass a local file instead by giving its path via the `file` parameter, replacing the normal `url` parameter.\n\n## Component icons\n\nCustom icon can be set for a library by adding an `icon` key to the definition.\n\n## Changes\n\n* 0.4.0 (2021-01-15)\n  - Added support for loading Swagger definitions from local files\n* 0.3.0 (2020-12-11)\n  - Updated for the latest noflo-assembly\n* 0.2.3 (2020-09-21)\n  - Added safety to Assembly components in case there is no definition for an API route\n* 0.2.2 (2020-09-16)\n  - Added custom icon support\n* 0.2.1 (2020-09-16)\n  - Added support for populating authorization keys from environment variables\n* 0.2.0 (2020-09-15)\n  - Added support for generating [NoFlo Assembly Line](https://github.com/noflo/noflo-assembly/wiki) components\n* 0.1.1 (2020-09-11)\n  - Improved test coverage\n* 0.1.0 (2020-09-09)\n  - Initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoflo%2Fnoflo-swagger-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoflo%2Fnoflo-swagger-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoflo%2Fnoflo-swagger-client/lists"}