Open Dogacel opened 1 year ago
Typedef support
I completely forgot about this. 😓 Let me handle it.
Numerated enum support
Did you menat TypedefedEnum
?
Did you menat
TypedefedEnum
?
No, I thought you can give numbers as enums (e.g. 1, 2) but JSON schema currently only accepts names (string) for enums.
Oops, I think I don't get it. 😅
you can give numbers as enums
Do you mean specifying numbers as enums when sending a request? But, couldn't we get the information of enums when creating the JSON schema regardless of the Numerated enum?
Oops, I think I don't get it. 😅
you can give numbers as enums
Do you mean specifying numbers as enums when sending a request? But, couldn't we get the information of enums when creating the JSON schema regardless of the Numerated enum?
Yeah, we do have more information (possible enum values are autocompleted). I just wanted to fully support existing features but if you think nobody uses numbers as enums while sending thrift requests then it should be fine.
Ah ah, so you mean we can create the JSON schema with the information but we cannot support auto-completion when sending a request using numbers? Is that correct? 😄 Then, probably we can specify all the values we support? 🤔
{
"enum": ["red", "amber", "green", 1, 2, 3]
}
Ah ah, so you mean we can create the JSON schema with the information but we cannot support auto-completion when sending a request using numbers? Is that correct? 😄 Then, probably we can specify all the values we support? 🤔
{ "enum": ["red", "amber", "green", 1, 2, 3] }
Updated ticket description.
Typedef support (currently they are only object).
This will be supported by https://github.com/line/armeria/pull/4628
Motivation:
Improve JSON Schema support for
Thrift
TText
protocol to ramp upDocService
.Parent PR:
4518
Requirements:
Typedef
support (currently they are onlyobject
).map<..., Enum>
support (container types sometimes miss enum definitions)Union
supportbinary
supportNote: It seems like typedefs are unresolved types in ServiceSpecification
413
so we first need to fix that.
For enum support, the generated schema can look like this:
Testing
Compared schemas for
FooService
HelloService
OnewayHelloService
SleepService
We can compare using
HBase
andCassandra
but I got kinda lazy and my Thrift knowledge is very low.Here is the current status of the schema as of 31.12.2022: