-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: few changes on zod schemas for compatibility with jsonschema parsers #68
base: release/1.2.1
Are you sure you want to change the base?
Conversation
|
ee3a44c
to
6bba959
Compare
@@ -117,26 +117,28 @@ export type EventMetadataDetails = PublicationMetadataCommon & { | |||
|
|||
const EventMetadataDetailsSchema: z.ZodType<EventMetadataDetails, z.ZodTypeDef, object> = | |||
metadataDetailsWith({ | |||
title: nonEmptyStringSchema().describe('The title of the event.').optional(), | |||
title: NonEmptyStringSchema.describe('The title of the event.').optional(), | |||
|
|||
mainContentFocus: mainContentFocus(PublicationMainFocus.EVENT), | |||
|
|||
location: z |
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.
We could call this union out into definitions so to have a nice rust type name generated out of it (e.g., EventLocation
).
// shared from other schemas
enum EncryptableUri {
...
}
enum EncryptableString {
// ...
}
// specific to this schema for now as used only here (I believe)
enum EventLocation {
EncryptableUri(EncryptableUri),
EncryptableString(EncryptableString)
}
or we can even massage this further so that generated type is 'more flat':
enum EventLocation {
Uri(URI), /// would be nice to make to our repo types URI, is it possible?
String(String),
EcnryptedString(EcnryptedString),
}
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.
the issue with this one is we cannot reliably distinguish between string and encryptedstring without knowledge of the context
No description provided.