Skip to content

Implement Field Selection#61

Merged
JonoPrest merged 20 commits into
mainfrom
jp/implement-field-selection
Jul 10, 2024
Merged

Implement Field Selection#61
JonoPrest merged 20 commits into
mainfrom
jp/implement-field-selection

Conversation

@JonoPrest

@JonoPrest JonoPrest commented Jul 8, 2024

Copy link
Copy Markdown
Collaborator

TODOs:

  • Validate selectable RPC fields
  • Apply selectable RPC fields to response
  • Handle raw events table fields
  • Handle event sync state table fields
  • Fix TestHelpers event mocking
  • Fix Tests
  • Updated templates

@JonoPrest JonoPrest force-pushed the jp/implement-field-selection branch from 150e02a to aa092ee Compare July 8, 2024 13:51
@github-actions

github-actions Bot commented Jul 8, 2024

Copy link
Copy Markdown

Here's the diff of the codegen output.🙌🧠🦜

@JonoPrest JonoPrest force-pushed the jp/implement-field-selection branch 2 times, most recently from d481511 to 5231c73 Compare July 8, 2024 19:22
@JonoPrest JonoPrest requested review from DZakh and JasoonS July 9, 2024 09:25
@JonoPrest

Copy link
Copy Markdown
Collaborator Author

@DZakh & @JasoonS,

The codegen code is ready for review. I'm about to board my plane. So if you want to review that so long.

I still need to updated tests and templates for the breaking changes.

@DZakh DZakh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the comment about the schema creation everything looks really good 👍

And I already anticipate the pain to solve merge conflicts for my #63 PR 🫠

}
]
},
"field_selection": {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe add new configuration options in camel case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The discussion I had with Jason was that we should try and make the config the same as hypersync queries. Unfortunately casing is all over the place between languages/products. I think lets keep it copy/paste-able from a hypersync query.

}

#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, JsonSchema)]
#[serde(deny_unknown_fields)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice


module Block = {
type selectableFields = {
{{!-- Selectable fields --}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about to include the comments in generated code?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do, although it's more a note for the template.

Comment on lines +146 to +148
{{#each field_selection.block_fields as | field |}}
{{field.name.camel}}: _s.field("{{field.name.camel}}", {{field.res_schema_code}}),
{{/each}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are no fields, it'll complain that nothing is returned from the function

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed it by adding a return type. So empty record is fine.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@JonoPrest JonoPrest force-pushed the jp/implement-field-selection branch from 238f800 to dcf53d8 Compare July 10, 2024 09:41
@JonoPrest JonoPrest force-pushed the jp/implement-field-selection branch from dcf53d8 to 5b71449 Compare July 10, 2024 11:53
@JonoPrest JonoPrest marked this pull request as ready for review July 10, 2024 11:55

@DZakh DZakh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢🚢🚢

@JonoPrest JonoPrest merged commit 18fa6af into main Jul 10, 2024
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.

3 participants