Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement an OpenAPIComparator #194

Merged
merged 16 commits into from
Dec 18, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -74,7 +74,8 @@ lazy val allProjectAggregates: Seq[ProjectReference] =
openapiCirceYaml.projectRefs ++
asyncapiModel.projectRefs ++
asyncapiCirce.projectRefs ++
asyncapiCirceYaml.projectRefs
asyncapiCirceYaml.projectRefs ++
openapiComparatorTests.projectRefs

lazy val projectAggregates: Seq[ProjectReference] = if (sys.env.isDefinedAt("STTP_NATIVE")) {
println("[info] STTP_NATIVE defined, including native in the aggregate projects")
@@ -262,3 +263,23 @@ lazy val asyncapiCirceYaml: ProjectMatrix = (projectMatrix in file("asyncapi-cir
settings = commonJvmSettings
)
.dependsOn(asyncapiCirce)

lazy val openapiComparatorTests: ProjectMatrix = (projectMatrix in file("openapi-comparator-tests"))
abdelfetah18 marked this conversation as resolved.
Show resolved Hide resolved
.settings(commonSettings)
.settings(
name := "openapi-comparator-tests",
publish / skip := true
)
.jvmPlatform(
scalaVersions = scalaJVMVersions,
settings = commonJvmSettings
)
.jsPlatform(
scalaVersions = scalaJSVersions,
settings = commonJsSettings
)
.nativePlatform(
scalaVersions = scalaNativeVersions,
settings = commonNativeSettings
)
.dependsOn(openapiModel, openapiCirce, circeTestUtils % Test)
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"openapi": "3.1.0",
"info": {
"title": "Sample Pet Store App",
"summary": "A pet store manager.",
"description": "This is a sample server for a pet store.",
"termsOfService": "https://example.com/terms/",
"contact": {
"name": "API Support",
"url": "https://www.example.com/support",
"email": "[email protected]"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.3"
},
"servers": [
{
"url": "http://petstore.swagger.io/v1"
}
],
"paths": {
"/pets": {
"get": {
"operationId": "getPets",
"description": "Gets all pets",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
},
"post": {
"operationId": "addPet",
"description": "Add a new pet",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NewPet"
}
}
}
},
"responses": {
"201": {
"description": "Pet created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
},
"/pets/{petId}": {
"get": {
"operationId": "getPetById",
"description": "Get a pet by its ID",
"parameters": [
{
"name": "petId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
},
"description": "The ID of the pet to retrieve"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"404": {
"description": "Pet not found"
}
}
}
}
},
"components": {
"schemas": {
"Pet": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
}
}
},
"NewPet": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
},
"required": [
"name"
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"openapi": "3.1.0",
"info": {
"title": "Sample Pet Store App",
"summary": "A pet store manager.",
"description": "This is a sample server for a pet store.",
"termsOfService": "https://example.com/terms/",
"contact": {
"name": "API Support",
"url": "https://www.example.com/support",
"email": "[email protected]"
},
"license": {
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.2"
},
"servers": [
{
"url": "http://petstore.swagger.io/v1"
}
],
"paths": {
"/pets": {
"get": {
"operationId": "getPets",
"description": "Gets all pets",
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
}
},
"/pets/{petId}": {
"get": {
"operationId": "getPetById",
"description": "Get a pet by its ID",
"parameters": [
{
"name": "petId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
},
"description": "The ID of the pet to retrieve"
}
],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
},
"404": {
"description": "Pet not found"
}
}
}
}
},
"components": {
"schemas": {
"Pet": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int32"
},
"name": {
"type": "string"
}
}
}
}
}
}
Loading