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
use SString schema for LocalDateTime codec #989
Conversation
I think the solution here might be a bit simpler :) First of all, examples are not part of the schema type - they can be provided by the user, but don't have to be. Hence I'd leave the The test is good - let's leave it - however we need to somehow provide example values. Following the docs on customising schemas, this could be sth like: implicit val testSchemaForInstant: Schema[Instant] = Schema.instant.example(an example instant instance) That is, we take the default schema for instant and extend it with a higher-priority implicit. As for the |
Ah, one of the original issues might be that we don't have a schema for |
Swagger uses https://tools.ietf.org/html/rfc3339 specification and treats date-time fields as points in time in UTC zone, so only Instant and java.util.Date classes are compatibile with that |
@@ -142,7 +139,7 @@ object Schema extends SchemaExtensions with SchemaMagnoliaDerivation with LowPri | |||
implicit val schemaForZonedDateTime: Schema[ZonedDateTime] = Schema(SDateTime) | |||
implicit val schemaForOffsetDateTime: Schema[OffsetDateTime] = Schema(SDateTime) | |||
implicit val schemaForDate: Schema[Date] = Schema(SDateTime) | |||
implicit val schemaForLocalDateTime: Schema[LocalDateTime] = Schema(SDateTime) | |||
implicit val schemaForLocalDateTime: Schema[LocalDateTime] = Schema(SString) | |||
implicit val schemaForLocalDate: Schema[LocalDate] = Schema(SDate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about LocalDate
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave SDate schema for it, as swagger using it returns correct example, eg. "2017-07-21"
No description provided.