{"id":13712603,"url":"https://github.com/SmartBear/swagger4j","last_synced_at":"2025-05-06T22:31:19.788Z","repository":{"id":66264121,"uuid":"10291255","full_name":"SmartBear/swagger4j","owner":"SmartBear","description":"A simple java library for reading and writing swagger definitions","archived":true,"fork":false,"pushed_at":"2020-10-15T19:26:40.000Z","size":137,"stargazers_count":26,"open_issues_count":8,"forks_count":13,"subscribers_count":40,"default_branch":"master","last_synced_at":"2024-11-13T23:32:23.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/SmartBear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-2.0.txt","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":"2013-05-25T23:32:28.000Z","updated_at":"2023-01-28T12:14:29.000Z","dependencies_parsed_at":"2023-03-22T03:18:39.525Z","dependency_job_id":null,"html_url":"https://github.com/SmartBear/swagger4j","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswagger4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswagger4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswagger4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartBear%2Fswagger4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartBear","download_url":"https://codeload.github.com/SmartBear/swagger4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252779039,"owners_count":21802868,"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":[],"created_at":"2024-08-02T23:01:20.240Z","updated_at":"2025-05-06T22:31:19.235Z","avatar_url":"https://github.com/SmartBear.png","language":"Java","funding_links":[],"categories":["By Technology"],"sub_categories":["Java"],"readme":"## swagger4j\n\nA simple java library for reading and writing [Swagger 1.X definitions](https://swagger.io). Supports both JSON and XML formats. The current version is\nreasonably in line with the latest swagger core release except that it doesn't support any of the JSON Schema/Data Model constructs yet. Apache 2.0 licensed.\n\nIf you're interested in reading Swagger 2.0 definitions you're better off using the official [swagger-parser](https://github.com/swagger-api/swagger-parser)\n\n### Getting started\n\nClone this repo from GitHub and build it yourself with maven (with \"mvn install\"). \n\nThe latest version is also available in the SmartBear maven repository at soapui.org, add this to your pom with\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003esoapUI Repository\u003c/id\u003e\n        \u003curl\u003ehttp://www.soapui.org/repository/maven2\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\nand add the corresponding dependency:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.smartbear\u003c/groupId\u003e\n    \u003cartifactId\u003eswagger4j\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nswagger4j has a runtime dependency\non jsonp ([https://java.net/projects/jsonp/](https://java.net/projects/jsonp/)) which you can add to your maven pom with.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eorg.glassfish\u003c/groupId\u003e\n    \u003cartifactId\u003ejavax.json\u003c/artifactId\u003e\n    \u003cversion\u003e1.0-b06\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nOnce added to your classpath you can start reading swagger definitions, for example\n\n```java\nResourceListing resourceListing = Swagger.readSwagger( \"http://petstore.swagger.wordnik.com/api/api-docs.json\" )\nfor( ResourceListingApi apiRef : resourceListing.getApis() )\n{\n   ApiDeclaration apiDeclaration = apiRef.getDeclaration();\n   for( Api api : apiDeclaration.getApis())\n   {\n       ...\n   }\n}\n```\n\nand of course you can write them as well\n\n```java\nSwaggerFactory factory = Swagger.createSwaggerFactory();\n\nApiDeclaration apiDeclaration = factory.createApiDeclaration( \"http://api.mycompany.com/apis\", \"/user\" );\nApi api = apiDeclaration.addApi( \"{id}\" );\nOperation op = api.addOperation( \"getuserbyid\", Operation.Method.GET );\nop.addParameter( \"id\", Parameter.ParamType.path );\n\nResourceListing rl = factory.createResourceListing( \"http://api.mycompany.com/apis\" );\nrl.setApiVersion( \"1.0\" );\nrl.addApi( apiDeclaration, \"user-doc.{format}\" );\n\nSwagger.writerSwagger( rl, \"api-docs\" );\n```\n\nThe API is closely modeled after the Swagger specification, if you are familiar with that it should be a breeze to use.\nIf you aren't familiar with Swagger and its spec head right over to the swagger website at \n[https://github.com/wordnik/swagger-core/wiki](https://github.com/wordnik/swagger-core/wiki) to learn all about it.\n\nJavadoc is available in the zip at sourceforge.\n\n### Library Design\n\nSwagger4j uses a standard Factory/Builder approach with interfaces defining the entire Swagger object model and a\ndefault implementation implementing them. If you have any suggestions on how to improve the actual API please don't\nhesitate to get in touch by adding tickets here at GitHub for bugs, issues, feature requests - Thank you!\n\nPlease note the following:\n- the whole DataModel/DataType part of Swagger is not yet supported\n- paths to APIs referred to in a ResourceListing are resolved by adding the path of the api to the basePath defined\nin the resourceListing. If the basePath is relative - it is resolved relatively to the host/root of the ResourceListing\nURI.\n\n### Usages\n\n* Version 0.2+ of the SoapUI-Swagger-Plugin use swagger4j to parse and generate Swagger definitions.\n\n### Future improvements\n\n* None planned at this point!\n\n### Release History\n\n* 20130527 - Initial beta1 release\n* 20131119 - beta2 release, adds support for Swagger 1.2 and 1.0\n* 20140505 - beta3 bugfixes\n* 20140512 - beta4 more bugfixes\n* 20151029 - 1.0.0 release - more bugfixes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSmartBear%2Fswagger4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSmartBear%2Fswagger4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSmartBear%2Fswagger4j/lists"}