-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
458 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@keystone-next/keystone': major | ||
--- | ||
|
||
In the `decimal` field, `defaultValue` is now a static number written as a string, `isRequired` has moved to `validation.isRequired` and now also requires the input isn't `NaN`, along with new `validation.min` and `validation.max` options. The `decimal` field can also be made non-nullable at the database-level with the `isNullable` option which defaults to `true`. `graphql.read.isNonNull` can also be set if the field has `isNullable: false` and you have no read access control and you don't intend to add any in the future, it will make the GraphQL output field non-nullable. `graphql.create.isNonNull` can also be set if you have no create access control and you don't intend to add any in the future, it will make the GraphQL create input field non-nullable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/keystone/src/fields/types/decimal/tests/non-null/test-fixtures.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { decimal } from '../..'; | ||
|
||
export const name = 'Decimal with isNullable: false'; | ||
export const typeFunction = (x: any) => decimal({ isNullable: false, ...x }); | ||
export const exampleValue = () => '6.28'; | ||
export const exampleValue2 = () => '6.45'; | ||
export const supportsGraphQLIsNonNull = true; | ||
export const supportsUnique = true; | ||
export const skipRequiredTest = true; | ||
export const fieldName = 'price'; | ||
export const unSupportedAdapterList = ['sqlite']; | ||
|
||
export const getTestFields = () => ({ | ||
price: decimal({ scale: 2, isFilterable: true, isNullable: false }), | ||
}); | ||
|
||
export const initItems = () => { | ||
return [ | ||
{ name: 'price1', price: '-123.45' }, | ||
{ name: 'price2', price: '0.01' }, | ||
{ name: 'price3', price: '50.00' }, | ||
{ name: 'price4', price: '2000.00' }, | ||
{ name: 'price5', price: '40000.00' }, | ||
{ name: 'price6', price: '1.00' }, | ||
{ name: 'price7', price: '2.00' }, | ||
]; | ||
}; | ||
|
||
export const storedValues = () => [ | ||
{ name: 'price1', price: '-123.45' }, | ||
{ name: 'price2', price: '0.01' }, | ||
{ name: 'price3', price: '50.00' }, | ||
{ name: 'price4', price: '2000.00' }, | ||
{ name: 'price5', price: '40000.00' }, | ||
{ name: 'price6', price: '1.00' }, | ||
{ name: 'price7', price: '2.00' }, | ||
]; | ||
|
||
export const supportedFilters = () => []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.