{"id":40078142,"url":"https://github.com/stefankoppier/openapi-validator","last_synced_at":"2026-01-19T09:03:33.484Z","repository":{"id":170927066,"uuid":"646046176","full_name":"stefankoppier/openapi-validator","owner":"stefankoppier","description":"Library for validating OpenAPI specifications","archived":false,"fork":false,"pushed_at":"2023-11-01T06:30:02.000Z","size":1345,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-11-01T07:26:09.883Z","etag":null,"topics":["testing","validation"],"latest_commit_sha":null,"homepage":"https://stefankoppier.github.io/openapi-validator/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefankoppier.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,"governance":null}},"created_at":"2023-05-27T05:41:25.000Z","updated_at":"2023-06-25T15:20:18.000Z","dependencies_parsed_at":"2023-10-11T02:47:26.945Z","dependency_job_id":"bb74ff12-14a7-4fb4-9b9d-c6911127ab16","html_url":"https://github.com/stefankoppier/openapi-validator","commit_stats":null,"previous_names":["stefankoppier/openapi-validator"],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/stefankoppier/openapi-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefankoppier%2Fopenapi-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefankoppier%2Fopenapi-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefankoppier%2Fopenapi-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefankoppier%2Fopenapi-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefankoppier","download_url":"https://codeload.github.com/stefankoppier/openapi-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefankoppier%2Fopenapi-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28565001,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T08:53:44.001Z","status":"ssl_error","status_checked_at":"2026-01-19T08:52:40.245Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["testing","validation"],"created_at":"2026-01-19T09:03:33.425Z","updated_at":"2026-01-19T09:03:33.479Z","avatar_url":"https://github.com/stefankoppier.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gradle Plugin Portal](https://img.shields.io/gradle-plugin-portal/v/io.github.stefankoppier.openapi.validator)](https://plugins.gradle.org/plugin/io.github.stefankoppier.openapi.validator)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.stefankoppier.openapi.validator/core)](https://mvnrepository.com/artifact/io.github.stefankoppier.openapi.validator)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stefankoppier_openapi-validator\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stefankoppier_openapi-validator)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=stefankoppier_openapi-validator\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=stefankoppier_openapi-validator)\n\n# OpenAPI Validator\n\nThe OpenAPI Validator allows you to validate your OpenAPI specification by writing a descriptive ruleset in Kotlin!\nThere is an extensive set of built-in rules and is extensible, as it allows you to add custom rules easily. \n\nVisit [the project documentation](https://stefankoppier.github.io/openapi-validator/) for a complete overview of the \nfunctionality.\n\n## Features\n\n### Rules\nAll properties of the OpenAPI specification have a corresponding rule. For example, if you want to validate that the\npath `/pet/findByStatus` has a get operation with the required query parameter `status` you can write\n```kotlin\nopenAPI {\n    paths {\n        required()\n        path(named = \"/pet/findByStatus\") {\n            get { \n                parameters {\n                    parameter(named = \"status\") {\n                      required()\n                      `in` { exactly(\"query\") }\n                    }\n                }\n            }\n        }\n    }\n}\n```\n\n### Quantifier Rules\nThere is support for quntification on the relevant types. For example\n```kotlin\nopenAPI {\n    paths {\n        all {\n            startsWith(\"prefix\")\n        }\n    }\n}\n```\nstates that all paths must start with the string `prefix`.\n\n### Preconditions\nThere is support for preconditions. The general precondition `given` validates a given rule only if\nthe predicate is true. For example\n```kotlin\nopenAPI {\n    info {\n        given({ it != null \u0026\u0026 it.length \u003e 20 }) {\n            description { lowercase() }\n        }\n    }\n}\n```\nstates that the field `description` of the `info` field must lowercase when it is not null, and it's length is\ngreater than 20.\n\nThere is also the `since` precondition, which states that something should hold only if the given date is in\nthe past. For example\n```kotlin\nopenAPI {\n    info {\n        since(LocalDate.of(2024, 1, 1)) {\n            title { lowercase() }\n        }\n    }\n}\n```\nstates that the field `title` of the `info` field must be in lowercase after January 1ˢᵗ of 2024.  \n\n## Usage\n\nThe OpenAPI Validator allows for two ways to execute the validation: via Gradle or via JUnit.\n\n### Gradle Integration\n\nApply the plugin\n```kotlin\nplugins {\n    id(\"io.github.stefankoppier.openapi.validator\") version \"x.y.z\"\n}\n```\nand then configure the document to be verified using the given rules using\n```kotlin\nopenAPIValidate {\n    document.set(uri(\"petstore.yaml\"))\n    rules.set(\n        openAPI {\n            info {\n                title { exactly(\"OpenAPI Petstore\") }\n            }\n        }\n    )\n}\n```\n\n### JUnit Integration\n\nAdd the package to your dependencies.\n\nThen extend your test class with `@ExtendWith(OpenAPIValidationExtension::class)` to add loading of a specification. \nThe specification can be loaded using the annotation `@OpenAPITest(relativeUrl = \"src/test/resources/petstore.yaml\")` to \nspecify the location of the specification. For example\n```kotlin\n@ExtendWith(OpenAPIValidationExtension::class)\n@OpenAPITest(relativeUrl = \"src/test/resources/petstore.yaml\")\nclass OpenAPIValidationExtensionTest {\n\n    @Test\n    fun `my petstore test`() {\n        assertDocumentIsValidFor {\n            openAPI(\"My specification\") {\n                info {\n                    title { exactly(\"OpenAPI Petstore\") }\n                }\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefankoppier%2Fopenapi-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefankoppier%2Fopenapi-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefankoppier%2Fopenapi-validator/lists"}