I am trying to make a simple schema for a book. For some reason, the UUID generated by a.id() is a type ‘string’, cannot be the identifier? Do I need to create an autoincremented integer ID value, and if so, how do I specify this in the schema and to GraphQL? I’m familiar with SQL languages. Would be nice to use a GUID.
The code
<code>import { type ClientSchema, a, defineData } from '@aws-amplify/backend';
const schema = a.schema({
Book: a
.model({
bookId: a.id().required(),
name: a.string(),
publisher: a.url(),
inLanguage: a.string(),
ISBN: a.integer(),
author: a.url(),
image: a.url(),
numberOfPages: a.integer(),
datePublished: a.date()
})
.identifier(["bookId"])
.authorization((allow) => [allow.guest()]),
});
</code>
<code>import { type ClientSchema, a, defineData } from '@aws-amplify/backend';
const schema = a.schema({
Book: a
.model({
bookId: a.id().required(),
name: a.string(),
publisher: a.url(),
inLanguage: a.string(),
ISBN: a.integer(),
author: a.url(),
image: a.url(),
numberOfPages: a.integer(),
datePublished: a.date()
})
.identifier(["bookId"])
.authorization((allow) => [allow.guest()]),
});
</code>
import { type ClientSchema, a, defineData } from '@aws-amplify/backend';
const schema = a.schema({
Book: a
.model({
bookId: a.id().required(),
name: a.string(),
publisher: a.url(),
inLanguage: a.string(),
ISBN: a.integer(),
author: a.url(),
image: a.url(),
numberOfPages: a.integer(),
datePublished: a.date()
})
.identifier(["bookId"])
.authorization((allow) => [allow.guest()]),
});
The error
<code>webpack 5.91.0 compiled with 1 error in 199 ms
assets by status 4.46 MiB [cached] 2 assets
cached modules 4.69 MiB (javascript) 27.8 KiB (runtime) [cached] 1532 modules
./amplify_outputs.json 2.24 KiB [built]
ERROR in D:Codeprojectamplifydataresource.ts
23:17-25
[tsl] ERROR in D:CodeAWS-Tricoamplifydataresource.ts(23,18)
TS2322: Type 'string' is not assignable to type 'never'.
ts-loader-default_e3b0c44298fc1c14
</code>
<code>webpack 5.91.0 compiled with 1 error in 199 ms
assets by status 4.46 MiB [cached] 2 assets
cached modules 4.69 MiB (javascript) 27.8 KiB (runtime) [cached] 1532 modules
./amplify_outputs.json 2.24 KiB [built]
ERROR in D:Codeprojectamplifydataresource.ts
23:17-25
[tsl] ERROR in D:CodeAWS-Tricoamplifydataresource.ts(23,18)
TS2322: Type 'string' is not assignable to type 'never'.
ts-loader-default_e3b0c44298fc1c14
</code>
webpack 5.91.0 compiled with 1 error in 199 ms
assets by status 4.46 MiB [cached] 2 assets
cached modules 4.69 MiB (javascript) 27.8 KiB (runtime) [cached] 1532 modules
./amplify_outputs.json 2.24 KiB [built]
ERROR in D:Codeprojectamplifydataresource.ts
23:17-25
[tsl] ERROR in D:CodeAWS-Tricoamplifydataresource.ts(23,18)
TS2322: Type 'string' is not assignable to type 'never'.
ts-loader-default_e3b0c44298fc1c14