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

Add a default export which maps OData names to typescript interfaces #64

Merged
merged 1 commit into from
May 28, 2024

Conversation

Page-
Copy link
Contributor

@Page- Page- commented May 9, 2024

No description provided.

@Page- Page- requested a review from a team May 9, 2024 18:59
test/index.ts Outdated Show resolved Hide resolved
src/generate.ts Outdated
` ${sqlNameToODataName(tableName)}: ${modelNameToCamelCaseName(m.tables[tableName].name)};`,
)
.join('\n')}
// Synonyms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want to output this comment even when no synonyms exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not that fussed either way personally but I'll look into either removing or replacing it with a // No synonyms to make it clear that there are no synonyms vs something weird happening/a bug

src/generate.ts Outdated
@@ -188,5 +188,21 @@ ${Object.keys(m.tables)
return tableToInterface(m, t);
})
.join('\n\n')}

export default interface Model {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using a weirder name in order to reduce the chance of conflicting w/ an actual resource that consumer might have?
Eg $ModelMap (in the SDK, as you probably saw, we use the poorly inspired ResourceTypeMap)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thgreasi I thought because it is a default export that it wouldn't clash, but it turns out it would.. I've renamed it to $Model to avoid clashes and the name shouldn't usually matter because it should just be accessed via import type Model from ...

@Page- Page- force-pushed the odata-to-ts-interface branch 3 times, most recently from ecb9352 to 003f566 Compare May 28, 2024 14:53
@Page- Page- requested review from joshbwlng and thgreasi May 28, 2024 14:54
@Page- Page- marked this pull request as ready for review May 28, 2024 14:59
@Page- Page- enabled auto-merge May 28, 2024 14:59
@Page- Page- force-pushed the odata-to-ts-interface branch 2 times, most recently from bb7b9f9 to 37a490c Compare May 28, 2024 15:04
@Page- Page- merged commit 5eb18d7 into master May 28, 2024
48 checks passed
@Page- Page- deleted the odata-to-ts-interface branch May 28, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants