{"id":15663267,"url":"https://github.com/melroy89/fastify-shared-definition-issue","last_synced_at":"2025-04-20T20:31:23.876Z","repository":{"id":237442638,"uuid":"775685405","full_name":"melroy89/fastify-shared-definition-issue","owner":"melroy89","description":"Reproduction code for shared definitions for response object issue","archived":true,"fork":false,"pushed_at":"2024-09-18T16:20:01.000Z","size":46,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T08:46:29.890Z","etag":null,"topics":["fastify","fastify-swagger","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/melroy89.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-21T21:10:20.000Z","updated_at":"2024-10-07T23:18:40.000Z","dependencies_parsed_at":"2024-05-01T22:37:48.855Z","dependency_job_id":"aa90af67-1470-4bd1-90fb-d6423a157bda","html_url":"https://github.com/melroy89/fastify-shared-definition-issue","commit_stats":null,"previous_names":["melroy89/fastify-shared-definition-issue"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melroy89%2Ffastify-shared-definition-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melroy89%2Ffastify-shared-definition-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melroy89%2Ffastify-shared-definition-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melroy89%2Ffastify-shared-definition-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melroy89","download_url":"https://codeload.github.com/melroy89/fastify-shared-definition-issue/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249958085,"owners_count":21351590,"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":["fastify","fastify-swagger","swagger"],"created_at":"2024-10-03T13:36:14.484Z","updated_at":"2025-04-20T20:31:23.615Z","avatar_url":"https://github.com/melroy89.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reproducible repo for Fastify Shared Response schema\n\nSee code: `app.js` \u0026 `routes/root.js`\n\n1. `npm install`\n2. `npm run dev`\n3. Go to: http://127.0.0.1:3000/docs\n4. See error message appear in Swagger:\n\n```sh\nResolver error at paths./.get.responses.500.content.application/json.schema.$ref\nCould not resolve reference: Could not resolve pointer: /components/schemas/def-0/definitions/internalServerErrorResponse does not exist in document\n```\n\n(No errors appear in the console log)\n\nBecause Swagger is **NOT** built to use `definitions` via `addSchema` for response objects, instead Swagger is built to use `components` -\u003e `responses` schemas for shared responses objects instead.\n\n---\n\nSwagger support `components` with `responses` this during OpenAPI spec definition (Fastify Swagger doesn't support this). Example ofa such an OpenAPI document:\n\n```js\n{\n    openapi: '3.0.0',\n    info: {\n        title: 'Example...'\n    },\n    components: {\n        responses: {\n            internalServerErrorResponse: {\n                description: \"500 Internal Server Error\",\n                content: {\n                    \"application/json\": {\n                        \"schema\": {\n                            \"type\": \"object\",\n                        }\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\nSuch a component response object above could be used for reusability, if that was supported by Fastify Swagger.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelroy89%2Ffastify-shared-definition-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelroy89%2Ffastify-shared-definition-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelroy89%2Ffastify-shared-definition-issue/lists"}