{"id":50332965,"url":"https://github.com/rspereiratech/openapi-collection-generator-samples","last_synced_at":"2026-05-29T11:01:12.143Z","repository":{"id":356574483,"uuid":"1233116355","full_name":"rspereiratech/openapi-collection-generator-samples","owner":"rspereiratech","description":"Sample Maven project demonstrating the openapi-collection-generator-maven-plugin — generates Postman and Insomnia collections from an OpenAPI 3.0 Pet Store specification.","archived":false,"fork":false,"pushed_at":"2026-05-08T17:13:44.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-05-08T18:41:21.830Z","etag":null,"topics":["api","api-tools","code-generation","insomnia","java","java17","maven","maven-plugin","openapi","openapi3","postman","postman-collection","rest-api","sample","swagger"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rspereiratech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-08T15:57:32.000Z","updated_at":"2026-05-08T17:13:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rspereiratech/openapi-collection-generator-samples","commit_stats":null,"previous_names":["rspereiratech/openapi-collection-generator-samples"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/rspereiratech/openapi-collection-generator-samples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspereiratech%2Fopenapi-collection-generator-samples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspereiratech%2Fopenapi-collection-generator-samples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspereiratech%2Fopenapi-collection-generator-samples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspereiratech%2Fopenapi-collection-generator-samples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspereiratech","download_url":"https://codeload.github.com/rspereiratech/openapi-collection-generator-samples/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspereiratech%2Fopenapi-collection-generator-samples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33648534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","api-tools","code-generation","insomnia","java","java17","maven","maven-plugin","openapi","openapi3","postman","postman-collection","rest-api","sample","swagger"],"created_at":"2026-05-29T11:01:11.092Z","updated_at":"2026-05-29T11:01:12.136Z","avatar_url":"https://github.com/rspereiratech.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenAPI Collection Generator – Samples\n\n[![Build](https://github.com/rspereiratech/openapi-collection-generator-samples/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/rspereiratech/openapi-collection-generator-samples/actions/workflows/build.yml)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n[![Java 17](https://img.shields.io/badge/Java-17-orange.svg)](https://openjdk.org/projects/jdk/17/)\n[![Maven 3.9+](https://img.shields.io/badge/Maven-3.9%2B-C71A36.svg?logo=apachemaven\u0026logoColor=white)](https://maven.apache.org/)\n[![OpenAPI 3.0](https://img.shields.io/badge/OpenAPI-3.0-6BA539.svg?logo=openapiinitiative\u0026logoColor=white)](https://spec.openapis.org/oas/v3.0.3)\n[![Postman v2.1](https://img.shields.io/badge/Postman-v2.1-FF6C37.svg?logo=postman\u0026logoColor=white)](https://schema.postman.com/)\n[![Insomnia v4](https://img.shields.io/badge/Insomnia-v4-4000BF.svg?logo=insomnia\u0026logoColor=white)](https://insomnia.rest/)\n[![Donate](https://img.shields.io/badge/Donate-NOWPayments-1A1A1A?logo=bitcoin\u0026logoColor=white)](https://nowpayments.io/donation/rspereiratech)\n\nReference samples for the\n[`openapi-collection-generator`](https://github.com/rspereiratech) ecosystem.\nThis repo demonstrates how to use each module — the **core** library, the\n**Postman** generator, the **Insomnia** generator, and the **Maven plugin** —\nagainst a small Pet Store OpenAPI 3.0 specification.\n\n## What's in the box\n\n```\n.\n├── pom.xml                               # Maven build, wires the Maven plugin\n├── src/main/resources/\n│   └── openapi.yaml                      # Sample Pet Store OpenAPI 3.0 spec\n└── collections/                          # Output produced by the plugin\n    ├── PetStore_postman.json\n    ├── PetStore_insomnia.json\n    └── PetStore.Production.environment.json\n```\n\n## Requirements\n\n- Java 17+\n- Maven 3.9+\n- The other modules installed locally (run `mvn install` in each sibling repo,\n  or use the top-level `build-all.sh`):\n  - `openapi-collection-generator-parent`\n  - `openapi-collection-generator-core`\n  - `openapi-collection-generator-postman`\n  - `openapi-collection-generator-insomnia`\n  - `openapi-collection-generator-maven-plugin`\n\n---\n\n## 1. Using the Maven plugin (this project)\n\nThe simplest entry point. Add the plugin to your `pom.xml` and let it generate\nboth Postman and Insomnia collections during `generate-resources`:\n\n```xml\n\u003cplugin\u003e\n    \u003cgroupId\u003eio.github.rspereiratech\u003c/groupId\u003e\n    \u003cartifactId\u003eopenapi-collection-generator-maven-plugin\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n    \u003cexecutions\u003e\n        \u003cexecution\u003e\n            \u003cid\u003egenerate-collections\u003c/id\u003e\n            \u003cgoals\u003e\n                \u003cgoal\u003egenerate\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n                \u003cformats\u003e\n                    \u003cformat\u003ePOSTMAN\u003c/format\u003e\n                    \u003cformat\u003eINSOMNIA\u003c/format\u003e\n                \u003c/formats\u003e\n                \u003ccollectionName\u003ePetStore\u003c/collectionName\u003e\n                \u003coutputDirectory\u003e${project.basedir}/collections\u003c/outputDirectory\u003e\n            \u003c/configuration\u003e\n        \u003c/execution\u003e\n    \u003c/executions\u003e\n\u003c/plugin\u003e\n```\n\nRun it:\n\n```bash\nmvn generate-resources\n```\n\nOr invoke the goal directly from the command line:\n\n```bash\nmvn io.github.rspereiratech:openapi-collection-generator-maven-plugin:generate \\\n    -Dopenapi.spec=src/main/resources/openapi.yaml \\\n    -Dopenapi.format=INSOMNIA \\\n    -Dopenapi.outputDir=target/collections\n```\n\nAvailable configuration:\n\n| Parameter         | Property                  | Default                                              |\n|-------------------|---------------------------|------------------------------------------------------|\n| `specFile`        | `openapi.spec`            | `${project.basedir}/src/main/resources/openapi.yaml` |\n| `outputDirectory` | `openapi.outputDir`       | `${project.build.directory}/generated-collections`   |\n| `formats`         | `openapi.format`          | `POSTMAN`                                            |\n| `collectionName`  | `openapi.collectionName`  | API title from the spec                              |\n| `baseUrl`         | `openapi.baseUrl`         | First server URL from the spec                       |\n\n---\n\n## 2. Using the core library programmatically\n\nWhen you need to embed the generator in your own tool (CLI, Gradle plugin,\ncustom build step), depend on the core module directly:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.rspereiratech\u003c/groupId\u003e\n    \u003cartifactId\u003eopenapi-collection-generator-core\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nThe single entry point is `CollectionGenerationOrchestrator`, which runs\nthe full pipeline (load → parse → generate → serialize → write):\n\n```java\nimport io.github.rspereiratech.openapi.collection.generator.core.*;\n\nGenerationRequest request = new GenerationRequest(\n        new File(\"src/main/resources/openapi.yaml\"),\n        new File(\"build/collections\"),\n        List.of(CollectionFormat.POSTMAN, CollectionFormat.INSOMNIA),\n        \"PetStore\"\n);\n\nCollectionGenerationOrchestrator orchestrator = /* wire components */;\nList\u003cGenerationResult\u003e results = orchestrator.generate(request);\n\nresults.forEach(r -\u003e System.out.println(\"Generated: \" + r.collectionFile()));\n```\n\nEach `GenerationResult` exposes the produced collection file plus any\nadditional artifacts (e.g. environment files).\n\n\u003e **Tip:** when generating multiple formats in a single run, the file name\n\u003e pattern in `GenerationRequest` must include `{format}` so outputs don't\n\u003e overwrite each other.\n\n---\n\n## 3. Using the Postman generator directly\n\nIf you only care about Postman and want full control over wiring, use\n`PostmanCollectionGenerator` from the Postman module:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.rspereiratech\u003c/groupId\u003e\n    \u003cartifactId\u003eopenapi-collection-generator-postman\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n```java\nimport io.github.rspereiratech.openapi.collection.generator.postman.generator.PostmanCollectionGenerator;\n\nPostmanCollectionGenerator generator = new PostmanCollectionGenerator(\n        operationGrouper,\n        collectionSerializer,\n        securityApplier,\n        serverEnvironmentGenerator\n);\n\nString collectionJson = generator.generate(openApi, generationConfig);\nList\u003cAdditionalFile\u003e environments =\n        generator.generateAdditionalFiles(openApi, generationConfig);\n```\n\nOutput:\n\n- `\u003ccollection-name\u003e.postman_collection.json` — Postman Collection v2.1.0\n- `\u003cserver-name\u003e.postman_environment.json` — one per OpenAPI server, with\n  `baseUrl` plus any required security variables as placeholders\n\n---\n\n## 4. Using the Insomnia generator directly\n\nSame idea, for Insomnia v4:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.rspereiratech\u003c/groupId\u003e\n    \u003cartifactId\u003eopenapi-collection-generator-insomnia\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n```java\nimport io.github.rspereiratech.openapi.collection.generator.insomnia.generator.InsomniaCollectionGenerator;\n\nInsomniaCollectionGenerator generator = new InsomniaCollectionGenerator(\n        idGenerator,\n        insomniaRequestBuilder,\n        collectionSerializer,\n        /* ...remaining collaborators... */\n);\n\nString insomniaJson = generator.generate(openApi, generationConfig);\n```\n\nThe resulting JSON can be imported directly via *Application → Preferences →\nData → Import Data* in Insomnia.\n\n---\n\n## Sample API\n\nThe included `openapi.yaml` describes a small **Pet Store** API with\nendpoints for listing, creating, and retrieving pets — enough surface area\nto exercise the most common request and response shapes (path parameters,\nquery parameters, JSON request bodies, multi-status responses).\n\n## Support\n\n[![Donate](https://img.shields.io/badge/Donate-NOWPayments-1A1A1A?logo=bitcoin\u0026logoColor=white)](https://nowpayments.io/donation/rspereiratech)\n\nIf this project saves you time, consider supporting development\nvia [NOWPayments](https://nowpayments.io/donation/rspereiratech).\nEvery contribution helps keep it maintained — thank you!\n\n## License\n\nReleased under the [MIT License](LICENSE).\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for setup and PR guidelines, and\n[SECURITY.md](SECURITY.md) for how to report security issues.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspereiratech%2Fopenapi-collection-generator-samples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspereiratech%2Fopenapi-collection-generator-samples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspereiratech%2Fopenapi-collection-generator-samples/lists"}