Skip to content
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

Javascript - Change .d.ts file to respect nullability? #106

Open
orta opened this issue Dec 26, 2021 · 2 comments
Open

Javascript - Change .d.ts file to respect nullability? #106

orta opened this issue Dec 26, 2021 · 2 comments

Comments

@orta
Copy link

orta commented Dec 26, 2021

Hey folks, I was going through some of the d.ts files and spotted that the types don't necessarily match the nullability in the db, for example:

export interface Group {
    avatar_url?: string;
    create_time?: string;
    creator_id?: string;
    description?: string;
    edge_count?: number;
    id?: string;
    lang_tag?: string;
    max_count?: number;
    metadata?: {};
    name?: string;
    open?: boolean;
    update_time?: string;
}

vs

Screen Shot 2021-12-26 at 3 55 05 PM

Which implies at least id, creator_id, name, metadata should be not marked as nullable. Is there something I am missing (e.g. partial requests etc)? If not, I can figure a way to update the .d.ts files to take this into account.

@novabyte
Copy link
Member

novabyte commented Jan 6, 2022

@orta Thanks for the feedback. You're right I think we've been a little loose with the nullable types in the Type definition file. Would appreciate a pull request on it if you get the chance 🙏

@orta
Copy link
Author

orta commented May 6, 2022

I've dug into this a bit, while the .d.ts generator doesn't account for whether something is optional in its code that is more of a downstream problem I believe.

The .d.ts file is generated from the swagger doc, which doesn't contain the info about the nullability of a property (and so my first attempt at looking at it in this repo isn't really enough.) we'd need to figure out how to get it represented in the json files in the nakama repo first

@lugehorsam lugehorsam changed the title Change .d.ts file to respect nullability? Javascript - Change .d.ts file to respect nullability? Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants