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

Support custom scalars #73

Closed
mat-sop opened this issue Feb 8, 2023 · 5 comments · Fixed by #82
Closed

Support custom scalars #73

mat-sop opened this issue Feb 8, 2023 · 5 comments · Fixed by #82
Assignees

Comments

@mat-sop
Copy link
Contributor

mat-sop commented Feb 8, 2023

No description provided.

@mat-sop mat-sop self-assigned this Feb 8, 2023
@lromanowicz
Copy link

Yes please! Any ETA on adding that? :D @mat-sop

@rafalp
Copy link
Contributor

rafalp commented Feb 10, 2023

Hello @lromanowicz, we don't have an ETA for this. Currently non-standard scalars are typed as Any by codegen and returned in their serialized form.

We are experimenting with both simple approach to scalars where you will define them using a section in pyproject.toml:

[ariadne-codegen.scalar.datetime]
py_type = "datetime.datetime"
serialize = ".datetime_scalar.serialize"
parse = ".datetime_scalar.parse"

And you will just add the datetime_scalar to list of files to include in final build.

But we are also considering a plugin system (#67) and letting plugins do the scalars by modifying the generated code, so result types would use Pydantic's magic for scalar's logic.

@lromanowicz

This comment was marked as off-topic.

@rafalp

This comment was marked as off-topic.

@lromanowicz

This comment was marked as off-topic.

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 a pull request may close this issue.

3 participants