diff --git a/package.json b/package.json index 71489390..828ded5d 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "express": "^4.17.1", "jest": "^29.3.1", "prettier": "^2.3.0", + "semver": "^7.4.0", "sqlite3": "^5.0.2" } } diff --git a/test/resources/models.json b/test/resources/models.json index d4de2274..36a0900a 100644 --- a/test/resources/models.json +++ b/test/resources/models.json @@ -4,7 +4,8 @@ "files": [ "./bookshop-graphql/srv/admin-service.cds", "./bookshop-graphql/srv/cat-service.cds" - ] + ], + "requires_cds": ">=6.8.0" }, { "name": "types", diff --git a/test/schemas/bookshop-graphql.gql b/test/schemas/bookshop-graphql.gql index a6b4be44..65a0576f 100644 --- a/test/schemas/bookshop-graphql.gql +++ b/test/schemas/bookshop-graphql.gql @@ -390,6 +390,7 @@ input AdminService_Chapters_orderBy { type AdminService_Currencies { code: String descr: String + minorUnit: Int16 name: String symbol: String texts( @@ -403,6 +404,7 @@ type AdminService_Currencies { input AdminService_Currencies_C { code: String descr: String + minorUnit: Int16 name: String symbol: String texts: [AdminService_Currencies_texts_C] @@ -411,6 +413,7 @@ input AdminService_Currencies_C { input AdminService_Currencies_U { code: String descr: String + minorUnit: Int16 name: String symbol: String texts: [AdminService_Currencies_texts_U] @@ -424,6 +427,7 @@ type AdminService_Currencies_connection { input AdminService_Currencies_filter { code: [String_filter] descr: [String_filter] + minorUnit: [Int16_filter] name: [String_filter] symbol: [String_filter] } @@ -444,6 +448,7 @@ type AdminService_Currencies_input { input AdminService_Currencies_orderBy { code: SortDirection descr: SortDirection + minorUnit: SortDirection name: SortDirection symbol: SortDirection } @@ -935,6 +940,7 @@ input CatalogService_Chapters_orderBy { type CatalogService_Currencies { code: String descr: String + minorUnit: Int16 name: String symbol: String texts( @@ -948,6 +954,7 @@ type CatalogService_Currencies { input CatalogService_Currencies_C { code: String descr: String + minorUnit: Int16 name: String symbol: String texts: [CatalogService_Currencies_texts_C] @@ -956,6 +963,7 @@ input CatalogService_Currencies_C { input CatalogService_Currencies_U { code: String descr: String + minorUnit: Int16 name: String symbol: String texts: [CatalogService_Currencies_texts_U] @@ -969,6 +977,7 @@ type CatalogService_Currencies_connection { input CatalogService_Currencies_filter { code: [String_filter] descr: [String_filter] + minorUnit: [Int16_filter] name: [String_filter] symbol: [String_filter] } @@ -989,6 +998,7 @@ type CatalogService_Currencies_input { input CatalogService_Currencies_orderBy { code: SortDirection descr: SortDirection + minorUnit: SortDirection name: SortDirection symbol: SortDirection } @@ -1315,6 +1325,20 @@ input Decimal_filter { ne: [Decimal] } +""" +The `Int16` scalar type represents 16-bit non-fractional signed whole numeric values. Int16 can represent values between -(2^15) and 2^15 - 1. +""" +scalar Int16 + +input Int16_filter { + eq: [Int16] + ge: [Int16] + gt: [Int16] + le: [Int16] + lt: [Int16] + ne: [Int16] +} + input Int_filter { eq: [Int] ge: [Int] diff --git a/test/tests/schema.test.js b/test/tests/schema.test.js index 1fdacb5b..6a6ee1aa 100644 --- a/test/tests/schema.test.js +++ b/test/tests/schema.test.js @@ -1,6 +1,11 @@ const fs = require('fs') const path = require('path') -const { models } = require('../resources') +const semver = require('semver') +const cdsVersion = require('@sap/cds').version + +let { models } = require('../resources') +models = models.filter(m => !m.requires_cds || semver.satisfies(cdsVersion, m.requires_cds)) + const { SCHEMAS_DIR, cdsFilesToGQLSchema, formatSchema } = require('../util') const { printSchema, validateSchema } = require('graphql')