{"id":22321833,"url":"https://github.com/supermomonga/openapi_rails_typed_parameters","last_synced_at":"2026-05-05T08:32:07.802Z","repository":{"id":215902413,"uuid":"739426895","full_name":"supermomonga/openapi_rails_typed_parameters","owner":"supermomonga","description":"Eliminate manual params validation code in Rails by using OpenAPI specification.","archived":false,"fork":false,"pushed_at":"2024-01-28T19:32:59.000Z","size":46,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-17T06:15:24.490Z","etag":null,"topics":["openapi","openapi3","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/supermomonga.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-05T14:40:52.000Z","updated_at":"2024-01-26T20:40:19.000Z","dependencies_parsed_at":"2024-01-07T09:21:52.689Z","dependency_job_id":"df7ef295-7d45-4d5e-9702-d79dc92dc139","html_url":"https://github.com/supermomonga/openapi_rails_typed_parameters","commit_stats":null,"previous_names":["supermomonga/openapi_rails_typed_parameters"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/supermomonga/openapi_rails_typed_parameters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermomonga%2Fopenapi_rails_typed_parameters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermomonga%2Fopenapi_rails_typed_parameters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermomonga%2Fopenapi_rails_typed_parameters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermomonga%2Fopenapi_rails_typed_parameters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/supermomonga","download_url":"https://codeload.github.com/supermomonga/openapi_rails_typed_parameters/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/supermomonga%2Fopenapi_rails_typed_parameters/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32642007,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"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":["openapi","openapi3","rails","ruby"],"created_at":"2024-12-04T00:23:21.980Z","updated_at":"2026-05-05T08:32:07.783Z","avatar_url":"https://github.com/supermomonga.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenapiRailsTypedParameters\n\n`openapi_rails_typed_parameters` is a library for performing parameter validation and coercion in Rails using OpenAPI definition files. It also supports providing static types through RBS generation.\n\nThis gem internally uses the [`openapi_first`](https://github.com/ahx/openapi_first) gem.\n\n### Main Objectives\n\n- Eliminate the code for params validation and type conversion (which is always a boring and routine task)\n- Provide an RBS generator (so you don't have to memorize parameters)\n\n### Differences from the `openapi_first` gem\n\n- Offers more tightly coupled features to Rails\n- Assists in statically typed programming by providing an RBS generator\n\n## :warning: This gem is under development.\n\nThis gem is currently under development. It is not recommended for use in production applications. Backward compatibility is not guaranteed until version 1.0.0 is released.\n\nOnce all of the following TODOs are completed, we will release version 1.0.0.\n\n### TODO\n\n- [ ] Coercion to more Rails application appropriate types, such as `ActiveSupport::TimeWithZone`\n- [ ] Provide more opinionated options for type conversions, such as coercion to `Symbol` for Enum value\n- [ ] Include a RBS generation generator for statically typed programming\n- [ ] Include RBS in the gem itself\n\n\n## Installation\n\nAdd `openapi_rails_typed_parameters` to your Gemfile.\n\n```rb\ngem 'openapi_rails_typed_parameters'\n```\n\n## Usage\n\nPlease add an initializer to your Rails application and specify the path to the OpenAPI schema file.\n\ne.g.) `config/initializers/openapi.rb`\n\n```openapi.rb\nrequire 'openapi_rails_typed_parameters'\n\nOpenapiRailsTypedParameters.configure do |config|\n  config.schema_path = Rails.root.join('schema.yml')\nend\n```\n\nThen, add `using OpenapiRailsTypedParameters` to your controller class. You can access statically typed parameters via `typed_parameters` method.\n\n## Example\n\n```schema.yml\nopenapi: 3.0.3\ninfo:\n  version: 1.0.0\n  title: Sample App\nservers:\n  - url: https://example.com/\npaths:\n  /users:\n    get:\n      parameters:\n        - name: role\n          in: query\n          required: true\n          schema:\n            type: string\n            enum: [ admin, maintainer ]\n        - name: minimum\n          in: query\n          required: false\n          schema:\n            type: integer\n        - name: maximum\n          in: query\n          required: false\n          schema:\n            type: integer\n```\n\n```users_controller.rb\nclass UsersController \u003c ApplicationController\n  using OpenapiRailsTypedParameters\n\n  def index\n    typed_params.validate!\n    res = {\n      role: typed_params.query_params.role # 'admin' or 'maintainer',\n      minimum: typed_params.query_params.minimum # Integer value\n      maximum: typed_params.query_params.maximum # Integer value\n    }\n    render json: res\n  rescue OpenapiFirst::RequestInvalidError =\u003e e\n    res = {\n      # e.g.)\n      # Query parameter is invalid: value at `/role` is not one of: [\"admin\", \"maintainer\"]\n      message: e.message\n    }\n    render json: res, status: :bad_request\n  end\nend\n```\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the OpenapiRailsTypedParameters project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/supermomonga/openapi_rails_typed_parameters/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupermomonga%2Fopenapi_rails_typed_parameters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsupermomonga%2Fopenapi_rails_typed_parameters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsupermomonga%2Fopenapi_rails_typed_parameters/lists"}