Skip to content
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

Open
wants to merge 17 commits into
base: release/1.2.1
Choose a base branch
from

Conversation

zannis
Copy link
Contributor

@zannis zannis commented Oct 2, 2024

No description provided.

Copy link

height bot commented Oct 2, 2024

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

@@ -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
Copy link
Member

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),
}

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants