Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: esm support on Odata #6061

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

Open
BrigittaK307 wants to merge 20 commits into main
base: main
Choose a base branch
Loading
from I753325-esm-support-oData
Open

Conversation

@BrigittaK307
Copy link

@BrigittaK307 BrigittaK307 commented Sep 17, 2025

No description provided.

url: ''
}
};
if (options.moduleType === 'esm') {
Copy link
Contributor

@deekshas8 deekshas8 Oct 17, 2025

Choose a reason for hiding this comment

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

[q] Why do we need this?

namedImports: [entity.className]
},
{
kind: StructureKind.ImportDeclaration,
Copy link
Contributor

@deekshas8 deekshas8 Oct 17, 2025

Choose a reason for hiding this comment

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

[q] Why did we change this? I now see an additional import statement import { RequestBuilder } from '@sap-cloud-sdk/odata-v4'

* @internal
*/
export interface PackageJsonOptions extends PackageJsonOptionsBase {
export interface PackageJsonOptions {
Copy link
Contributor

@deekshas8 deekshas8 Oct 17, 2025

Choose a reason for hiding this comment

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

generator-common package is shared between odata and openapi generators. Have we check if this affects openapi generator?

}

const project = new Project(projectOptions());
const tsConfig = await tsconfigJson(options);
Copy link
Contributor

@deekshas8 deekshas8 Oct 21, 2025

Choose a reason for hiding this comment

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

I didn't get why this was moved here?

* @internal
*/
export function getImportsWithESM(
schemaName: string,
Copy link
Contributor

@deekshas8 deekshas8 Oct 21, 2025

Choose a reason for hiding this comment

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

I didn't get the point of this function?

).toBe('./ComplexDesert');
});

it('importDeclarations with ESM', () => {
Copy link
Contributor

@deekshas8 deekshas8 Oct 21, 2025

Choose a reason for hiding this comment

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

Great that you added tests for this. I would restructure them to test for default (which should be commonjs) or esm.

},
{
names: ['Breakfast'],
moduleIdentifier: './Breakfast.js'
Copy link
Contributor

@deekshas8 deekshas8 Oct 22, 2025

Choose a reason for hiding this comment

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

[pp] If we only care about whether esm extension was generated, then I will only test for moduleIdentifier, instead of the whole object

namedImports: ['2']
} as ImportDeclarationStructure;

it('merges named imports', () => {
Copy link
Contributor

@deekshas8 deekshas8 Oct 23, 2025

Choose a reason for hiding this comment

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

[q] Why did we delete this file?


function projectOptions(): ProjectOptions {
function projectOptions(
moduleType: 'commonjs' | 'esm' = 'commonjs'
Copy link
Contributor

@deekshas8 deekshas8 Oct 23, 2025

Choose a reason for hiding this comment

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

Maybe it will make sense to create a separate type and reuse it, instead of typing it like this everywhere

Co-authored-by: Deeksha Sinha <88374536+deekshas8@users.noreply.github.com>
BrigittaK307 and others added 2 commits October 24, 2025 10:11
Co-authored-by: Deeksha Sinha <88374536+deekshas8@users.noreply.github.com>
Co-authored-by: Deeksha Sinha <88374536+deekshas8@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@deekshas8 deekshas8 deekshas8 requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /