{"id":19099084,"url":"https://github.com/smartbear/swaggerhub-gradle-plugin","last_synced_at":"2025-04-30T15:43:18.456Z","repository":{"id":33886324,"uuid":"138286993","full_name":"SmartBear/swaggerhub-gradle-plugin","owner":"SmartBear","description":"Gradle plugin for SwaggerHub","archived":false,"fork":false,"pushed_at":"2024-01-10T08:07:09.000Z","size":272,"stargazers_count":19,"open_issues_count":6,"forks_count":19,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-30T15:43:11.243Z","etag":null,"topics":["gradle","on-prem","saas","swaggerhub"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SmartBear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-06-22T09:59:59.000Z","updated_at":"2024-10-23T02:14:10.000Z","dependencies_parsed_at":"2023-12-21T18:29:13.049Z","dependency_job_id":"575270ab-acab-4fae-9e31-bf692b00571e","html_url":"https://github.com/SmartBear/swaggerhub-gradle-plugin","commit_stats":null,"previous_names":["smartbear/swaggerhub-gradle-plugin"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswaggerhub-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswaggerhub-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswaggerhub-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswaggerhub-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartBear","download_url":"https://codeload.github.com/SmartBear/swaggerhub-gradle-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251733866,"owners_count":21635033,"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":["gradle","on-prem","saas","swaggerhub"],"created_at":"2024-11-09T03:48:28.148Z","updated_at":"2025-04-30T15:43:18.427Z","avatar_url":"https://github.com/SmartBear.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://img.shields.io/jenkins/build.svg?jobUrl=https://jenkins.swagger.io/job/oss-swaggerhub-gradle-plugin)](https://jenkins.swagger.io/view/OSS%20-%20Java/job/oss-swaggerhub-gradle-plugin)\n\n# swaggerhub-gradle-plugin \u003cimg src=\"https://raw.githubusercontent.com/swagger-api/swagger.io/wordpress/images/assets/SW-logo-clr.png\" height=\"50\" align=\"right\"\u003e\nA simple gradle plugin to integrate [SwaggerHub](https:\\\\swaggerhub.com) hosting of [OpenAPI/Swagger](https://swagger.io/specification/) definitions with a gradle build process, using the [SwaggerHub API](https://app.swaggerhub.com/apis/swagger-hub/registry-api).\n\n## Features\n* Download/upload API definitions from/to SwaggerHub.\n* Supports `json` and `yaml` format for API definitions.\n* Authenticate with API key for restricted operations (e.g downloading a private API definition).\n* Connects to SwaggerHub cloud by default or local SwaggerHub instance through optional configuration.\n\nThe pattern of usage is likely to depend on whether a [code first or design first](https://swaggerhub.com/blog/api-design/design-first-or-code-first-api-development/) approach is followed.\n\n## Example use cases\n\n### Code First\n1. Code API implementation.\n2. Automatically generate API definition from implementation, e.g. via [swagger-core](https://github.com/swagger-api/swagger-core) [annotations](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Annotations) and [swagger gradle plugin](https://github.com/swagger-api/swagger-core/tree/master/modules/swagger-gradle-plugin). See also [swagger-core wiki](https://github.com/swagger-api/swagger-core/wiki/Swagger-2.X---Getting-started)\n3. Upload generated API definition to SwaggerHub with swaggerhub-gradle-plugin.\n\n### Design First\n1. Write API definition (e.g. in Swagger Editor or SwaggerHub).\n2. Download API definition with swaggerhub-gradle-plugin.\n3. Pass API definition to another Swagger tool e.g.\n    - [swagger-codegen](https://github.com/swagger-api/swagger-codegen) to generate API client and resource classes.\n    - [swagger-inflector](https://github.com/swagger-api/swagger-inflector) to automatically wire up the API definition to the implementation and provide out-of-the-box mocking.\n\n## Installation\n\n```\nplugins {\n  id \"io.swagger.swaggerhub\" version \"1.1.0\"\n}\n```\n\n## Tasks\n### swaggerhubDownload\n#### Example Usage\n* Download a public API definition in json format from SwaggerHub and save to a local file.\n```\nswaggerhubDownload {\n    api 'PetStoreAPI'\n    owner 'swagger-hub'\n    version '1.0.0'\n    outputFile 'target/test/petStoreAPI.json'\n}\n```\n\n#### Parameters\nParameter | Description                                                                                        | Required | Default\n--------- |----------------------------------------------------------------------------------------------------| --------- | -------\n**`api`** | API name                                                                                           | true  | -\n**`owner`** | API owner                                                                                          | true | -\n**`version`** | API version                                                                                        | true | -  \n**`outputFile`** | API definition is written to this file                                                             | true | -\n**`token`** | SwaggerHub API key, required to access private definitions                                         | false | -\n**`format`** | API definition format, `json` or `yaml`                                                            | false | `json`\n**`host`** | URL of SwaggerHub API                                                                              | false | `api.swaggerhub.com`\n**`protocol`** | Protocol for SwaggerHub API,`http` or `https`                                                      | false | `https`\n**`port`** | Port to access SwaggerHub API                                                                      | false | `443`\n**`oas`** | Version of the OpenApi Specification the definition adheres to                                     | false | `2.0`\n**`resolved`** | Download a resolved version of the API definition                                                  | false | `false`\n**`onPremise`** | Uses the API path suffix for on-premise SwaggerHub deployments                                     | false | `false`\n**`onPremiseAPISuffix`** | Custom API Suffix path for any future changes in SwaggerHub API pattern for on-premise deployments | false | `/v1`\n***\n\n### swaggerhubUpload\n#### Example Usage\n* Upload an API definition in json format as a public API in SwaggerHub.\n\n```\nswaggerhubUpload {\n    api 'PetStoreAPI'\n    owner 'swagger-hub'\n    version '1.0.1-SNAPSHOT'\n    inputFile 'target/petStoreAPI.json'\n    token  'duMmyAPiKEy'\n}\n```\n\n#### Example Usage together with `swagger-gradle-plugin` (code first)\n* Upload an API definition in json format (resolved via `swagger-gradle-plugin`)  as a public API in SwaggerHub.\n\n```\n\nplugins {\n    ...\n    id 'java'\n    id \"io.swagger.core.v3.swagger-gradle-plugin\" version '2.0.6'\n    id \"io.swagger.swaggerhub\" version \"1.0.1\"\n}\n\n...\n\nresolve {\n    outputFileName = 'PetStoreAPI'\n    outputFormat = 'JSON'\n    prettyPrint = 'TRUE'\n    classpath = sourceSets.main.runtimeClasspath\n    resourcePackages = ['test.petstore']\n    outputPath = 'target'\n}\n\nswaggerhubUpload {\n    dependsOn resolve\n    api 'PetStoreAPI'\n    owner 'swagger-hub'\n    version '1.0.1-SNAPSHOT'\n    inputFile 'target/petStoreAPI.json'\n    token  'duMmyAPiKEy'\n}\n```\n\n#### Parameters\nParameter | Description | Required | Default\n--------- | ----------- | --------- | -------\n**`api`** | API name | true  | -\n**`owner`** | API owner | true | -\n**`version`** | API version | true | -  \n**`inputFile`** | Local file containing the API definition in json or yaml format  | true | -\n**`token`** | SwaggerHub API key | true | -\n**`format`** | API definition format, `json` or `yaml` | false | `json`\n**`isPrivate`** | Defines whether the API should be private on SwaggerHub (using `true` requires a paid plan) | false | `false`\n**`host`** | URL of SwaggerHub API | false | `api.swaggerhub.com`\n**`protocol`** | Protocol for SwaggerHub API,`http` or `https` | false | `https`\n**`port`** | Port to access SwaggerHub API| false | `443`\n**`onPremise`** | Uses the API path suffix for on-premise SwaggerHub deployments                                     | false | `false`\n**`onPremiseAPISuffix`** | Custom API Suffix path for any future changes in SwaggerHub API pattern for on-premise deployments | false | `/v1`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartbear%2Fswaggerhub-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartbear%2Fswaggerhub-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartbear%2Fswaggerhub-gradle-plugin/lists"}