forked from zio/zio-http
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/conformance-spec
- Loading branch information
Showing
11 changed files
with
271 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
zio-http-gen/src/test/resources/EndpointWithRequestResponseBodyInlineMinMaxLength.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package test.api.v1 | ||
|
||
import test.component._ | ||
import zio.schema._ | ||
|
||
object Entries { | ||
import zio.http._ | ||
import zio.http.endpoint._ | ||
import zio.http.codec._ | ||
val post = Endpoint(Method.POST / "api" / "v1" / "entries") | ||
.in[POST.RequestBody] | ||
.out[POST.ResponseBody](status = Status.Ok) | ||
|
||
object POST { | ||
import zio.schema.annotation.validate | ||
import zio.schema.validation.Validation | ||
import java.util.UUID | ||
import java.time.Instant | ||
import java.time.LocalTime | ||
import java.time.LocalDate | ||
|
||
case class RequestBody( | ||
id: Int, | ||
@validate[String](Validation.maxLength(255) && Validation.minLength(1)) name: String, | ||
) | ||
object RequestBody { | ||
implicit val codec: Schema[RequestBody] = DeriveSchema.gen[RequestBody] | ||
} | ||
case class ResponseBody( | ||
@validate[String](Validation.maxLength(255) && Validation.minLength(1)) name: String, | ||
uuid: Option[UUID], | ||
deadline: Option[Instant], | ||
id: Int, | ||
time: Option[LocalTime], | ||
day: LocalDate, | ||
) | ||
object ResponseBody { | ||
implicit val codec: Schema[ResponseBody] = DeriveSchema.gen[ResponseBody] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
zio-http-gen/src/test/resources/inline_schema_minmaxlength.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
{ | ||
"openapi" : "3.1.0", | ||
"info" : { | ||
"title" : "", | ||
"version" : "" | ||
}, | ||
"paths" : { | ||
"/api/v1/entries" : { | ||
"post" : { | ||
"requestBody" : | ||
{ | ||
"content" : { | ||
"application/json" : { | ||
"schema" : | ||
{ | ||
"type" : | ||
"object", | ||
"properties" : { | ||
"id" : { | ||
"type" : | ||
"integer", | ||
"format" : "int32" | ||
}, | ||
"name" : { | ||
"type" : | ||
"string", | ||
"minLength" : 1, | ||
"maxLength" : 255 | ||
} | ||
}, | ||
"additionalProperties" : | ||
true, | ||
"required" : [ | ||
"id", | ||
"name" | ||
] | ||
} | ||
|
||
} | ||
}, | ||
"required" : true | ||
}, | ||
"responses" : { | ||
"200" : | ||
{ | ||
"description" : "", | ||
"content" : { | ||
"application/json" : { | ||
"schema" : | ||
{ | ||
"type" : | ||
"object", | ||
"properties" : { | ||
"id" : { | ||
"type" : | ||
"integer", | ||
"format" : "int32" | ||
}, | ||
"name" : { | ||
"type" : | ||
"string", | ||
"minLength" : 1, | ||
"maxLength" : 255 | ||
}, | ||
"day" : { | ||
"type" : | ||
"string", | ||
"format": "date" | ||
}, | ||
"deadline": { | ||
"type": "string", | ||
"format": "date-time" | ||
}, | ||
"time": { | ||
"type": "string", | ||
"format": "time" | ||
}, | ||
"uuid" : { | ||
"type" : | ||
"string", | ||
"format" : "uuid" | ||
} | ||
}, | ||
"additionalProperties" : | ||
true, | ||
"required" : [ | ||
"id", | ||
"name", | ||
"day" | ||
] | ||
} | ||
|
||
} | ||
} | ||
} | ||
}, | ||
"deprecated" : false | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.