Skip to content

Conversation

ruiaraujo
Copy link
Contributor

It allows covering opaque types.

I am using this together with a GraphQL endpoint which has custom scalars. These scalars are opaque from the type system so a JSON schema cannot be derived.

It allows covering opaque types.
index.js Outdated
else json+= null
`
} else throw new Error(`${schema} unsupported`)
} else {
Copy link
Member

@delvedor delvedor Jul 22, 2018

Choose a reason for hiding this comment

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

Probably just to be safe we can add a check here to verify that you are passing an empty schema.

function isEmpty (schema) {
   for (var key in schema) {
     if (schema.hasOwnProperty(key)) return false
   }
   return true
}

Could be enough :)

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

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

LGTM

@delvedor delvedor merged commit db2fa85 into fastify:master Jul 22, 2018
@delvedor
Copy link
Member

Landed in v1.7.0, thanks!

@ruiaraujo ruiaraujo deleted the any-schema branch July 22, 2018 21:44
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