{"id":20642658,"url":"https://github.com/alumbra/alumbra.generators","last_synced_at":"2025-04-16T01:42:24.062Z","repository":{"id":43617210,"uuid":"71592021","full_name":"alumbra/alumbra.generators","owner":"alumbra","description":"GraphQL Generators for Clojure's test.check","archived":false,"fork":false,"pushed_at":"2017-01-07T14:14:23.000Z","size":109,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T03:32:16.890Z","etag":null,"topics":["alumbra","graphql","property-based-testing"],"latest_commit_sha":null,"homepage":"https://alumbra.github.io/alumbra.generators/","language":"Clojure","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/alumbra.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}},"created_at":"2016-10-21T19:49:11.000Z","updated_at":"2021-04-28T19:37:09.000Z","dependencies_parsed_at":"2022-07-13T11:20:34.247Z","dependency_job_id":null,"html_url":"https://github.com/alumbra/alumbra.generators","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/alumbra%2Falumbra.generators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumbra%2Falumbra.generators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumbra%2Falumbra.generators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alumbra%2Falumbra.generators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alumbra","download_url":"https://codeload.github.com/alumbra/alumbra.generators/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249182807,"owners_count":21226123,"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":["alumbra","graphql","property-based-testing"],"created_at":"2024-11-16T16:09:46.969Z","updated_at":"2025-04-16T01:42:24.044Z","avatar_url":"https://github.com/alumbra.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alumbra.generators\n\nA collection of [test.check][tc] generators for [GraphQL][ql] queries.\n\n[![Build Status](https://travis-ci.org/alumbra/alumbra.generators.svg?branch=master)](https://travis-ci.org/alumbra/alumbra.generators)\n[![Clojars Project](https://img.shields.io/clojars/v/alumbra/generators.svg)](https://clojars.org/alumbra/generators)\n\n[tc]: https://github.com/clojure/test.check\n[ql]: http://graphql.org/\n\nThere are two types of queries that can be generated: random ones that show\nsyntactic correctness but might be utter nonsense, and those based on an\nanalyzed schema, being both syntactically and semantically correct.\n\n## Usage\n\n__[Documentation](https://alumbra.github.io/alumbra.generators/)__\n\n### Valid Data\n\nGiven a GraphQL schema ([parsed][alumbra-parser] and\n[analyzed][alumbra-analyzer]), a generator for valid GraphQL operations can\nbe built:\n\n```clojure\n(require '[alumbra.generators :as gen])\n\n(def gen-operation\n  (gen/operation\n    (-\u003e \"type Person { name: String!, pets: [Pet!] }\n         type Pet { name: String!, meows: Boolean }\n         type QueryRoot { person(name: String!): Person }\n         schema { query: QueryRoot }\"\n     (alumbra.analyzer/analyze-schema alumbra.parser/parse-schema))))\n```\n\nThis is a function that takes the operation type and, optionally, operation name\nand produces a string value representing our desired operation, conforming to\nthe above schema.\n\n```clojure\n(rand-nth\n  (clojure.test.check.generators/sample (gen-operation :query \"Q\")))\n;; =\u003e \"query Q {\n;;       __schema {\n;;         queryType { inputFields { defaultValue, description }, ... }\n;;       },\n;;       person(name: \\\"Mu90ChZ1ht\\\") { name }\n;;     }\"\n```\n\nAs you can see, the implicitly given introspection fields will be accessed\njust as well.\n\n[alumbra-parser]: https://github.com/alumbra/alumbra.parser\n[alumbra-analyzer]: https://github.com/alumbra/alumbra.analyzer\n\n### Random Data\n\n#### Query Documents\n\nThis generates a GraphQL document as described in the [GraphQL\nspecification][ql-spec].\n\n```clojure\n(clojure.test.check.generators/sample (gen/raw-document) 1)\n;; =\u003e (\"mutation X($h: [T]! = 0.8e-57753886, $Q: [K]! = 0.1693) { ...\")\n```\n\n[ql-spec]: https://facebook.github.io/graphql/\n\n#### Schema Documents\n\nThis generates a GraphQL IDL document. There is, as of the writing of this\nREADME, no complete specification on this, so it is based on the [Schemas and\nTypes](http://graphql.org/learn/schema/) guide, as well as the current state of\n[this PR](https://github.com/facebook/graphql/pull/90).\n\n```clojure\n(clojure.test.check.generators/sample (gen/raw-schema) 1)\n;; =\u003e (\"schema {query: O, mutation: B}\\ninterface G {D(c: [I]): [O]}\\nenum F {O}\")\n```\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2016 Yannick Scherer\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falumbra%2Falumbra.generators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falumbra%2Falumbra.generators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falumbra%2Falumbra.generators/lists"}