{"id":18994057,"url":"https://github.com/swaggest/swac","last_synced_at":"2025-04-22T12:47:02.261Z","repository":{"id":37587933,"uuid":"215669955","full_name":"swaggest/swac","owner":"swaggest","description":"🤖 OpenAPI/Swagger client generator for PHP, Go and JavaScript (ES5)","archived":false,"fork":false,"pushed_at":"2024-02-19T17:36:38.000Z","size":839,"stargazers_count":9,"open_issues_count":7,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-17T01:36:27.740Z","etag":null,"topics":["client-lib","codegen","go","javascript","openapi","php","rest-api","swagger"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/swaggest.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-10-17T00:32:59.000Z","updated_at":"2024-05-03T11:21:40.000Z","dependencies_parsed_at":"2024-06-19T06:12:10.321Z","dependency_job_id":"7a87ca65-f94a-4a5a-b995-3f21557f1cf8","html_url":"https://github.com/swaggest/swac","commit_stats":{"total_commits":71,"total_committers":5,"mean_commits":14.2,"dds":0.3661971830985915,"last_synced_commit":"b06a2d4e68d96c1758934bcbd43bc2f7fc39aa7f"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swaggest%2Fswac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swaggest","download_url":"https://codeload.github.com/swaggest/swac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250243347,"owners_count":21398327,"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":["client-lib","codegen","go","javascript","openapi","php","rest-api","swagger"],"created_at":"2024-11-08T17:24:02.873Z","updated_at":"2025-04-22T12:47:02.241Z","avatar_url":"https://github.com/swaggest.png","language":"PHP","readme":"# OpenAPI 3.0 / Swagger 2.0 compiler\n\nA tool to render API spec as code.\n\n[![Build Status](https://travis-ci.org/swaggest/swac.svg?branch=master)](https://travis-ci.org/swaggest/swac)\n[![codecov](https://codecov.io/gh/swaggest/swac/branch/master/graph/badge.svg)](https://codecov.io/gh/swaggest/swac)\n[![Image Size](https://images.microbadger.com/badges/image/swaggest/swac.svg)](https://microbadger.com/images/swaggest/swac)\n![Code lines](https://sloc.xyz/github/swaggest/swac/?category=code)\n![Comments](https://sloc.xyz/github/swaggest/swac/?category=comments)\n\n## Installation\n\n### Phar\n\nDownload `swac` from [releases](https://github.com/swaggest/swac/releases) page.\n\n### Docker\n\n```bash\ndocker run --rm swaggest/swac swac --help\n```\n\n```\nv0.1.28 swac\nOpenAPI/Swagger compiler, https://github.com/swaggest/swac\nUsage: \n   swac \u003caction\u003e\n   action   Action name                                                      \n            Allowed values: php-guzzle-client, go-client, js-client, markdown\n...\n```\n\nExample\n\n```bash\nmkdir petstore \u0026\u0026 cd petstore\ndocker run -v $(pwd):/code -u 1000:1000 swaggest/swac swac php-guzzle-client https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v2.0/json/petstore.json --namespace MyApp\\\\Petstore\n```\n\nSchema can be passed by STDIN using `-` as file path.\n\n```bash\ncat ./openapi.json | docker run -i --rm swaggest/swac swac markdown -\n```\n\n### Composer\n\n[Install PHP Composer](https://getcomposer.org/doc/00-intro.md)\n\n```bash\ncomposer global require swaggest/swac\n```\n\n## Usage\n\n### PHP Client\n\n```\nswac php-guzzle-client --help\n```\n\n```\nv0.1.0 swac php-guzzle-client\nOpenAPI/Swagger compiler, https://github.com/swaggest/swac\nUsage: \n   swac php-guzzle-client \u003cschemaPath\u003e --namespace \u003cnamespace\u003e\n   schemaPath   Path/URL to OpenAPI/Swagger schema\n   \nOptions: \n   --operations \u003coperations\u003e      Operations filter in form of comma-separated list of method/path, default empty\n   --project-path \u003cprojectPath\u003e   Path to project root, default ./                                               \n   --namespace \u003cnamespace\u003e        Project namespace\n```\n\nThe generated client depends on [`swaggest/rest-client`](https://github.com/swaggest/php-rest-client),\n`guzzlehttp/guzzle` 6, and [`swaggest/json-schema`](https://github.com/swaggest/php-json-schema).\n\n[Examples](/examples/php-guzzle-client).\n\n### Go Client\n\n```\nswac go-client --help \n```\n\n```\nv0.1.14 swac go-client\nOpenAPI/Swagger compiler, https://github.com/swaggest/swac\nUsage: \n   swac go-client \u003cschemaPath\u003e\n   schemaPath   Path/URL to OpenAPI/Swagger schema\n   \nOptions: \n   --operations \u003coperations\u003e               Operations filter in form of comma-separated list of method/path, default empty                  \n   --out \u003cout\u003e                             Path to output package, default ./client                                                         \n   --pkg-name \u003cpkgName\u003e                    Output package name, default \"client\"                                                            \n   --skip-default-additional-properties    Do not add field property for undefined `additionalProperties`                                   \n   --skip-do-not-edit                      Skip adding \"DO NOT EDIT\" comments                                                               \n   --add-request-tags                      Add field tags with name and location to request structure properties, e.g. 'ID int `query:\"id\"`'\n   --show-const-properties                 Show properties with constant values, hidden by default                                          \n   --keep-parent-in-property-names         Keep parent prefix in property name, removed by default                                          \n   --ignore-nullable                       Add `omitempty` to nullable properties, removed by default                                       \n   --ignore-xgo-type                       Ignore `x-go-type` in schema to skip generation                                                  \n   --with-zero-values                      Use pointer types to avoid zero value ambiguity                                                  \n   --fluent-setters                        Add fluent setters to struct fields                                                              \n   --ignore-required                       Ignore if property is required when deciding on pointer type or omitempty                        \n   --renames \u003crenames...\u003e                  Map of exported symbol renames, example From:To                                                  \n   --with-tests                            Generate (un)marshaling tests for entities (experimental feature)                                \n   --require-xgenerate                     Generate properties with `x-generate: true` only                                                 \n   --validate-required                     Generate validation code to check required properties during unmarshal                           \n```\n\n[Examples](/examples/go-client).\n\nThe generated client is a single package without external dependencies.\n\n### JavaScript Client\n\n```\nswac js-client --help \n```\n\n```\nv0.1.21 swac js-client\nOpenAPI/Swagger compiler, https://github.com/swaggest/swac\nUsage: \n   swac js-client \u003cschema\u003e\n   schema   Path/URL to OpenAPI/Swagger schema\n   \nOptions: \n   --operations \u003coperations\u003e      Operations filter in form of comma-separated list of method/path, default empty         \n   --ignore-operation-id          Ignore operationId and always name operations using method and path                     \n   --client-name \u003cclientName\u003e     Name of generated client class, default APIClient                                       \n   --types-prefix \u003ctypesPrefix\u003e   Prefix generated jsdoc class names                                                      \n   --out \u003cout\u003e                    Path to output files, default ./client                                                  \n   --patches \u003cpatches...\u003e         JSON patches to apply to schema file before processing, merge patches are also supported\n```\n\n[Examples](/examples/js-client).\n\n```\nswac js-client openapi.json --out ./ --client-name Backend --types-prefix xh\n```\n\nThe generated client is a ES5 class using `XMLHttpRequest` and `jsdoc` type definitions without external dependencies\nsuitable for direct usage in browsers.\n\n### Markdown\n\n```\nswac markdown --help\n```\n```\nv0.1.24 swac markdown\nOpenAPI/Swagger compiler, https://github.com/swaggest/swac\nUsage: \n   swac markdown \u003cschema\u003e\n   schema   Path/URL to OpenAPI/Swagger schema\n   \nOptions: \n   --operations \u003coperations\u003e         Operations filter in form of comma-separated list of method/path, default empty         \n   --ignore-operation-id             Ignore operationId and always name operations using method and path                     \n   --client-name \u003cclientName\u003e        Name of generated client class, default APIClient                                       \n   --add-schema-url \u003caddSchemaUrl\u003e   Add schema link to the document                                                         \n   --types-prefix \u003ctypesPrefix\u003e      Prefix generated type names                                                             \n   --out \u003cout\u003e                       Path to output files, default ./client                                                  \n   --patches \u003cpatches...\u003e            JSON patches to apply to schema file before processing, merge patches are also supported\n \n```\n\n[Examples](/examples/).\n\n```\nswac markdown openapi.json --out ./API-Docs.md --types-prefix xh\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswaggest%2Fswac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswaggest%2Fswac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswaggest%2Fswac/lists"}