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

To support the exclusion of annotations from manifest json for cap projects #1994

Merged
merged 19 commits into from
Jun 6, 2024

Conversation

kjose90
Copy link
Member

@kjose90 kjose90 commented May 31, 2024

#1949

  • fiori-elements-writer:
    Update fiori-elements-writer to not append local annotation names to FE service if the service type is CDS.
  • Move logic to write annotation cds to odata-service-writer
    Add logic for writing annotation CDS files to the odata-service-writer module. If the service type is CDS and annotations are provided, write the annotations into the CDS file.-
  • Enhance the OdataService annotation feature to accommodate both EDMX and CAP interfaces.

Copy link

changeset-bot bot commented May 31, 2024

🦋 Changeset detected

Latest commit: 5003513

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@sap-ux/fiori-elements-writer Minor
@sap-ux/odata-service-writer Minor
@sap-ux/generator-simple-fe Patch
@sap-ux/fiori-freestyle-writer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kjose90 kjose90 marked this pull request as ready for review June 4, 2024 09:10
@kjose90 kjose90 requested review from a team as code owners June 4, 2024 09:10
@kjose90 kjose90 requested a review from longieirl June 4, 2024 14:19
devinea
devinea previously approved these changes Jun 5, 2024
Copy link
Member

@devinea devinea left a comment

Choose a reason for hiding this comment

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

Code changes appear to coverage the necessary changes to support CAP projects service and annotation writing.
changeset ✅

@@ -13,15 +13,17 @@ import type { NamespaceAlias, OdataService } from '../types';
export function getAnnotationNamespaces({ metadata, annotations }: Partial<OdataService>): NamespaceAlias[] {
// Enhance service with annotations namespaces
const schemaNamespaces = metadata ? getNamespaces(metadata) : [];

if (annotations?.xml) {
const edmxAnnotations = annotations as EdmxAnnotationsInfo;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we not test for the property of EdmxAnnotationsInfo before casting to that type?

Suggested change
const edmxAnnotations = annotations as EdmxAnnotationsInfo;
if (edmxAnnotations?.xml) {
const edmxAnnotations = annotations as EdmxAnnotationsInfo;

Copy link
Member Author

@kjose90 kjose90 Jun 5, 2024

Choose a reason for hiding this comment

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

getAnnotationNamespaces is called only if service is edmx so I think its okay?

Copy link
Contributor

@IainSAP IainSAP Jun 6, 2024

Choose a reason for hiding this comment

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

But thats not relevant within the context of the function. Please update to cast after determining the type. I think that makes more logically sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or better still change the parameter type to be EdmxAnnotationInfo if that is what should be passed to this function.

@kjose90 kjose90 requested a review from devinea June 5, 2024 12:54
@kjose90 kjose90 requested a review from IainSAP June 5, 2024 14:13
Copy link
Member

@devinea devinea left a comment

Choose a reason for hiding this comment

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

Latest commits to skip adding proxy middleware backend config is appropriate for CAP.
Re-approving.

Copy link

sonarcloud bot commented Jun 6, 2024

Copy link
Contributor

@longieirl longieirl left a comment

Choose a reason for hiding this comment

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

Changes look good.
Test coverage is good.
Changeset looks good.

@kjose90
Copy link
Member Author

kjose90 commented Jun 6, 2024

Thanks for reviewing everyone

@kjose90 kjose90 merged commit e9a007a into main Jun 6, 2024
13 checks passed
@kjose90 kjose90 deleted the refactor/move-cds-to-service-writers branch June 6, 2024 14:25
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

4 participants