{"id":21766047,"url":"https://github.com/narazaka/json-schema-subset-dsl","last_synced_at":"2025-10-07T20:31:38.760Z","repository":{"id":56879607,"uuid":"224978566","full_name":"Narazaka/json-schema-subset-dsl","owner":"Narazaka","description":"Yet another JSON Schema subset DSL for Ruby","archived":false,"fork":false,"pushed_at":"2022-03-08T08:52:55.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T23:44:43.253Z","etag":null,"topics":["json-schema","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Narazaka.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}},"created_at":"2019-11-30T07:53:21.000Z","updated_at":"2024-08-06T20:20:56.000Z","dependencies_parsed_at":"2022-08-20T23:10:45.284Z","dependency_job_id":null,"html_url":"https://github.com/Narazaka/json-schema-subset-dsl","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fjson-schema-subset-dsl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fjson-schema-subset-dsl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fjson-schema-subset-dsl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narazaka%2Fjson-schema-subset-dsl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Narazaka","download_url":"https://codeload.github.com/Narazaka/json-schema-subset-dsl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235655399,"owners_count":19024617,"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":["json-schema","ruby"],"created_at":"2024-11-26T13:15:01.343Z","updated_at":"2025-10-07T20:31:33.454Z","avatar_url":"https://github.com/Narazaka.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Json::Schema::Subset::DSL\n\n[![Actions Status](https://github.com/Narazaka/json-schema-subset-dsl/workflows/Ruby/badge.svg)](https://github.com/Narazaka/json-schema-subset-dsl/actions)\n[![Gem Version](https://badge.fury.io/rb/json-schema-subset-dsl.svg)](https://badge.fury.io/rb/json-schema-subset-dsl)\n\nYet another JSON Schema subset DSL.\n\nUseful when writing a simple JSON schema.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'json-schema-subset-dsl'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install json-schema-subset-dsl\n\n## Usage\n\n```ruby\noptions = {\n  reference_name: -\u003e(name) { name.sub(/Serializer$/, \"\"),\n}\n\ndsl = Json::Schema::Subset::DSL.new(options) do\n  title! \"Example\"\n  id :integer\n  name :string, minLength: 1, optional: true\n  items :array, optional: true do\n  end\n  other_names :array, optional: true do\n    string!\n    null!\n  end\n  meta :object do\n    description :string\n    params :array do\n      ref! \"#/components/schemas/Param\"\n    end\n    opt_params :array do\n      cref! \"OptParamSerializer\"\n    end\n    uuid :ref, \"#/UUID\", optional: true\n  end\nend\n\ndsl.compile! == {\n  \"type\" =\u003e \"object\",\n  \"properties\" =\u003e {\n    \"id\" =\u003e { \"type\" =\u003e \"integer\" },\n    \"name\" =\u003e { \"minLength\" =\u003e 1, \"type\" =\u003e \"string\" },\n    \"items\" =\u003e { \"items\" =\u003e { \"type\" =\u003e \"object\", \"properties\" =\u003e {} }, \"type\" =\u003e \"array\" },\n    \"other_names\" =\u003e { \"items\" =\u003e { \"type\" =\u003e %w[string null] }, \"type\" =\u003e \"array\" },\n    \"meta\" =\u003e {\n      \"type\" =\u003e \"object\",\n      \"properties\" =\u003e {\n        \"description\" =\u003e { \"type\" =\u003e \"string\" },\n        \"params\" =\u003e { \"items\" =\u003e { \"$ref\" =\u003e \"#/components/schemas/Param\" }, \"type\" =\u003e \"array\" },\n        \"opt_params\" =\u003e { \"items\" =\u003e { \"$ref\" =\u003e \"#/components/schemas/OptParam\" }, \"type\" =\u003e \"array\" },\n        \"uuid\" =\u003e { \"$ref\" =\u003e \"#/UUID\" },\n      },\n      \"required\" =\u003e %w[description params opt_params],\n    },\n  },\n  \"required\" =\u003e %w[id meta],\n  \"title\" =\u003e \"Example\",\n}\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Narazaka/json-schema-subset-dsl.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarazaka%2Fjson-schema-subset-dsl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarazaka%2Fjson-schema-subset-dsl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarazaka%2Fjson-schema-subset-dsl/lists"}