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

[WIP] Require serialization/deserialization functions for custom scalars #94

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

captbaritone
Copy link
Owner

@captbaritone captbaritone commented Dec 30, 2023

Fixes #66

TODO

  • Rename args in @-exports directive to be more generic
  • Clean up codegen
  • Check/fix integration tests
    • Test all serialization/deserialization validation failure cases
  • Add unit test validating the error you get when you don't export your type
  • Revisit docs

Copy link

netlify bot commented Dec 30, 2023

Deploy Preview for grats ready!

Name Link
🔨 Latest commit 49597cb
🔍 Latest deploy log https://app.netlify.com/sites/grats/deploys/658fdd291f6e0e000805a8bf
😎 Deploy Preview https://deploy-preview-94--grats.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

const abs = resolveRelativePath(module);
const relative = stripExt(
path.relative(path.dirname(this._destination), abs),
);
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: Extract this so it can be shared

),
name,
);
if (name === "serialize") {
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: Comment explaining why we do this

@@ -769,7 +921,7 @@ class Codegen {
}

function fieldDirective(
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: Rename?

@@ -18,10 +18,21 @@ type SomeType {
hello: String
}

scalar MyUrl
scalar MyUrl @exported(tsModulePath: "grats/src/tests/fixtures/custom_scalars/DefineCustomScalar.ts", functionName: "MyUrl", argCount: 0)
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: Rename functionName to something more generic.
TODO: Make argCount optional?

-----------------
{
"data": {
"echo": null, // TODO: That's not write
Copy link
Owner Author

Choose a reason for hiding this comment

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

TODO: Look into these todos

@@ -196,7 +196,7 @@ const testDirs = [

const schemaModule = await import(schemaPath);

const actualSchema = schemaModule.getSchema();
const actualSchema = schemaModule.getSchema(server.config);
Copy link
Owner Author

Choose a reason for hiding this comment

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

Nice.

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.

Needed: Mechanism for defining serialize/deserialize functions for custom scalars
1 participant