-
Notifications
You must be signed in to change notification settings - Fork 411
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
[gen] adding support for "Any" and "AnyObject" as json in codegen #3205
base: main
Are you sure you want to change the base?
[gen] adding support for "Any" and "AnyObject" as json in codegen #3205
Conversation
@@ -1077,7 +1078,10 @@ final case class EndpointGen(config: Config) { | |||
), | |||
) | |||
case JsonSchema.Null => throw new Exception("Null query parameters are not supported") | |||
case JsonSchema.AnyJson => throw new Exception("AnyJson query parameters are not supported") | |||
case JsonSchema.AnyJson => { | |||
// throw new Exception("AnyJson query parameters are not supported") |
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.
why did we previously throw exception?
Am I breaking some other validation now?
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.
@987Nabil any idea regarding this one?
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.
- Please no
{}
block for a case handling :) - The exception was that there is no handling implemented. Not that there can't be one
None
seems odd. Can you explain?
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.
- sure, will do
- the exception refers to query parameters, so that was weiird.
- the method is
def schemaToCode(…): Option[Code.File]
, there is no need to generate a file forJson
. It's just an import. SoNone
was obvious to me.
zio-http/shared/src/main/scala/zio/http/endpoint/openapi/JsonSchema.scala
Outdated
Show resolved
Hide resolved
eats: {} | ||
extra_attributes: | ||
type: object | ||
additionalProperties: true |
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.
should also test for all the 3 out of 4 possible cases we handle?
extra_attributes:
type: object
additionalProperties: true
extra_attributes:
type: object
additionalProperties: {}
extra_attributes:
additionalProperties: true
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.
Sorry, help me out. This dynamic fields open api always confuses me
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.
this is straight out of the docs:
d4ef6d4
to
afe0bce
Compare
@@ -1077,7 +1078,10 @@ final case class EndpointGen(config: Config) { | |||
), | |||
) | |||
case JsonSchema.Null => throw new Exception("Null query parameters are not supported") | |||
case JsonSchema.AnyJson => throw new Exception("AnyJson query parameters are not supported") | |||
case JsonSchema.AnyJson => { | |||
// throw new Exception("AnyJson query parameters are not supported") |
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.
- Please no
{}
block for a case handling :) - The exception was that there is no handling implemented. Not that there can't be one
None
seems odd. Can you explain?
eats: {} | ||
extra_attributes: | ||
type: object | ||
additionalProperties: true |
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.
Sorry, help me out. This dynamic fields open api always confuses me
MetaData.KeySchema( | ||
fromSerializableSchema(keySchema), | ||
|
||
val definedAttributesCount = schema.productIterator.count(_.asInstanceOf[Option[_]].isDefined) |
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.
One thing I learned from the zio http open api integration: I hate it and open API is a crap format haha 😂
afe0bce
to
2640057
Compare
extra_attributes: type: object additionalProperties: true extra_attributes: type: object additionalProperties: {} extra_attributes: additionalProperties: true but fails for this case, which might not be an issue (or an issue with zio-schema): extra_attributes: additionalProperties: {}
7007e5c
to
feedb58
Compare
/fixes #3199
/claim #3199