-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(clientapi): Fix generated TypeScript admin client code to correspond to test data #1478
Conversation
I got into some issues because properties are now declared as optional:
Is this intended? |
I changed the TypeScript class generation template so that if a property has cardinality |
It's fine if the users array is empty, but it shouldn't be optional. knoraApiConnection.admin.usersEndpoint.getUsers().subscribe(
(response: ApiResponseData<UsersResponse>) => {
expect(response.body.users.length).toEqual(18);
expect(response.body.users[0].familyName).toEqual("Admin-alt");
done();
}); It's ok if the users array is empty (length zero), but this code breaks if users is |
OK then I guess I have to make a |
If that is possible, this would be great! I am just writing a short guideline how to integrate and try the generated code, will be ready soon. |
I thought that the admin API will always return an empty array if the sequence is empty. Are there any routes that don't behave like this? |
@subotic The route {
"projects":[
{
"description":[
{
"value":"Anything Project"
}
],
"id":"http://rdfh.ch/projects/0001",
"keywords":[
],
"logo":null,
"longname":"Anything Project",
"ontologies":[
"http://www.knora.org/ontology/0001/anything",
"http://www.knora.org/ontology/0001/something"
],
"selfjoin":false,
"shortcode":"0001",
"shortname":"anything",
"status":true
}
]
} In other admin API responses, a project has a |
The Which routes return the |
@subotic You're right, this must be my mistake. Somehow I must have got confused and thought that the project class needed a |
@benjamingeer I suggest to combine the review of this PR with the review of dasch-swiss/dsp-js-lib#72. dasch-swiss/dsp-js-lib#72 should be ready soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again!
@tobiasschweizer Thanks for your help and patience with this! |
@benjamingeer please coordinate with @subotic for merging, he is preparing a new release. |
Thank you :-) |
@subotic Should I merge this today, or wait till next month? It's not a breaking change and only affects client code generation. |
Fixes #1476.