Skip to content

Commit

Permalink
Showing 3 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ object OpenapiModels {
case class OpenapiParameter(
name: String,
in: String,
required: Boolean,
required: Option[Boolean],
description: Option[String],
schema: OpenapiSchemaType
)
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class EndpointGeneratorSpec extends CompileCheckTestBase {
Seq(
OpenapiPathMethod(
methodType = "get",
parameters = Seq(Resolved(OpenapiParameter("asd-id", "path", true, None, OpenapiSchemaString(false)))),
parameters = Seq(Resolved(OpenapiParameter("asd-id", "path", Some(true), None, OpenapiSchemaString(false)))),
responses = Seq(
OpenapiResponse(
"200",
@@ -136,7 +136,7 @@ class EndpointGeneratorSpec extends CompileCheckTestBase {
Seq(
OpenapiPathMethod(
methodType = "get",
parameters = Seq(Resolved(OpenapiParameter("id", "path", true, None, OpenapiSchemaString(true)))),
parameters = Seq(Resolved(OpenapiParameter("id", "path", Some(true), None, OpenapiSchemaString(true)))),
responses = Seq(
OpenapiResponse("202", "Processing", Seq(OpenapiResponseContent("text/plain", OpenapiSchemaString(false)))),
OpenapiResponse("404", "couldn't find thing", Seq(OpenapiResponseContent("text/plain", OpenapiSchemaString(false))))
@@ -152,7 +152,7 @@ class EndpointGeneratorSpec extends CompileCheckTestBase {
Seq(
OpenapiPathMethod(
methodType = "get",
parameters = Seq(Resolved(OpenapiParameter("id", "path", true, None, OpenapiSchemaString(true)))),
parameters = Seq(Resolved(OpenapiParameter("id", "path", Some(true), None, OpenapiSchemaString(true)))),
responses = Seq(
OpenapiResponse("204", "No body", Nil),
OpenapiResponse("403", "Not authorised", Nil)
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ object TestHelpers {
| parameters:
| - name: genre
| in: path
| required: true
| schema:
| type: string
| - $ref: '#/components/parameters/year'
@@ -157,10 +156,12 @@ object TestHelpers {
OpenapiPathMethod(
methodType = "get",
parameters = Seq(
Resolved(OpenapiParameter("genre", "path", true, None, OpenapiSchemaString(false))),
Resolved(OpenapiParameter("genre", "path", Some(true), None, OpenapiSchemaString(false))),
Ref[OpenapiParameter]("#/components/parameters/offset"),
Resolved(OpenapiParameter("limit", "query", true, Some("Maximum number of books to retrieve"), OpenapiSchemaInt(false))),
Resolved(OpenapiParameter("X-Auth-Token", "header", true, None, OpenapiSchemaString(false)))
Resolved(
OpenapiParameter("limit", "query", Some(true), Some("Maximum number of books to retrieve"), OpenapiSchemaInt(false))
),
Resolved(OpenapiParameter("X-Auth-Token", "header", Some(true), None, OpenapiSchemaString(false)))
),
responses = Seq(
OpenapiResponse(
@@ -178,9 +179,11 @@ object TestHelpers {
OpenapiPathMethod(
methodType = "post",
parameters = Seq(
Resolved(OpenapiParameter("year", "path", true, None, OpenapiSchemaInt(false))),
Resolved(OpenapiParameter("limit", "query", true, Some("Maximum number of books to retrieve"), OpenapiSchemaInt(false))),
Resolved(OpenapiParameter("X-Auth-Token", "header", true, None, OpenapiSchemaString(false)))
Resolved(OpenapiParameter("year", "path", Some(true), None, OpenapiSchemaInt(false))),
Resolved(
OpenapiParameter("limit", "query", Some(true), Some("Maximum number of books to retrieve"), OpenapiSchemaInt(false))
),
Resolved(OpenapiParameter("X-Auth-Token", "header", Some(true), None, OpenapiSchemaString(false)))
),
responses = Seq(
OpenapiResponse(
@@ -219,7 +222,7 @@ object TestHelpers {
)
),
parameters = Seq(
Resolved(OpenapiParameter("genre", "path", true, None, OpenapiSchemaString(false))),
Resolved(OpenapiParameter("genre", "path", None, None, OpenapiSchemaString(false))),
Ref("#/components/parameters/year")
)
)
@@ -232,8 +235,8 @@ object TestHelpers {
securitySchemes = Map.empty,
parameters = Map(
"#/components/parameters/offset" ->
OpenapiParameter("offset", "query", true, Some("Offset at which to start fetching books"), OpenapiSchemaInt(false)),
"#/components/parameters/year" -> OpenapiParameter("year", "path", true, None, OpenapiSchemaInt(false))
OpenapiParameter("offset", "query", Some(true), Some("Offset at which to start fetching books"), OpenapiSchemaInt(false)),
"#/components/parameters/year" -> OpenapiParameter("year", "path", Some(true), None, OpenapiSchemaInt(false))
)
)
)
@@ -315,7 +318,7 @@ object TestHelpers {
OpenapiPathMethod(
methodType = "get",
parameters = Seq(
Resolved(OpenapiParameter("name", "query", true, None, OpenapiSchemaString(false)))
Resolved(OpenapiParameter("name", "query", Some(true), None, OpenapiSchemaString(false)))
),
responses = Seq(
OpenapiResponse(
@@ -416,7 +419,7 @@ object TestHelpers {
OpenapiPathMethod(
methodType = "get",
Seq(
Resolved(OpenapiParameter("name", "path", true, None, OpenapiSchemaString(false)))
Resolved(OpenapiParameter("name", "path", Some(true), None, OpenapiSchemaString(false)))
),
responses = Seq(
OpenapiResponse(

0 comments on commit 623d0fb

Please sign in to comment.