Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hsla-specified-by-url.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphql-scalars': patch
---

Expose the `@specifiedBy` URL on the `HSLA` scalar so it matches its sibling `HSL`. Both now point to the same MDN reference and emit the `@specifiedBy` directive in the schema.
6 changes: 6 additions & 0 deletions src/scalars/HSLA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const validate = (value: any, ast?: ASTNode) => {
return value;
};

const specifiedByURL =
'https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#hsl()_and_hsla()';

export const GraphQLHSLA = /*#__PURE__*/ new GraphQLScalarType({
name: `HSLA`,

Expand All @@ -41,6 +44,9 @@ export const GraphQLHSLA = /*#__PURE__*/ new GraphQLScalarType({

return validate(ast.value, ast);
},

specifiedByURL,
specifiedByUrl: specifiedByURL,
extensions: {
codegenScalarType: 'string',
jsonSchema: {
Expand Down
6 changes: 6 additions & 0 deletions tests/HSLA.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,10 @@ describe(`HSLA`, () => {
});
});
});

it(`exposes a specifiedByURL like the HSL scalar`, () => {
expect(GraphQLHSLA.specifiedByURL).toBe(
`https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#hsl()_and_hsla()`,
);
});
});