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

Introspect with specifiedBy #18

Merged
merged 4 commits into from
Nov 4, 2024
Merged

Conversation

1e16miin
Copy link

According to GraphQL Spec October2021

When defining a custom scalar, GraphQL services should provide a [scalar specification URL](https://spec.graphql.org/October2021/#scalar-specification-url) via the @specifiedBy directive or the specifiedByURL introspection field.

In schema

type __Type {
  ...
  # may be non-null for custom SCALAR, otherwise null.
  specifiedByURL: String
}

Example query and result

If your service has a custom scalar called :Email and has defined :specified-by, such as ...

{:scalars {:Email {:parse parser-fn
                   :serialize serialize-fn
                   :specified-by "https://datatracker.ietf.org/doc/html/rfc5322"}}

image

@1e16miin 1e16miin requested a review from namenu October 31, 2024 06:57
@1e16miin 1e16miin changed the title Introspect with specified by Introspect with @specifiedBy Nov 1, 2024
(defn url?
[url]
(try
(URL. url)
Copy link
Member

Choose a reason for hiding this comment

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

URL constructor is deprecated since Java20.

(defn valid-url? [s]
  (try
    (let [uri (java.net.URI. s)]
      (.toURL uri)
      true)
    (catch Exception _ false)))

@1e16miin 1e16miin merged commit 5e1fca5 into master Nov 4, 2024
3 checks passed
@1e16miin 1e16miin changed the title Introspect with @specifiedBy Introspect with specifiedBy Nov 6, 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.

2 participants