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

Support OData flavors different than the default one of CAP #59

Open
fidsusj opened this issue Jul 3, 2023 · 0 comments
Open

Support OData flavors different than the default one of CAP #59

fidsusj opened this issue Jul 3, 2023 · 0 comments

Comments

@fidsusj
Copy link

fidsusj commented Jul 3, 2023

Let's assume I have the following entities in my CAP project and expose them directly via an OData service:

using {managed} from '@sap/cds/common';

entity Authors {
  key name: String(64);
      age: Integer;
      [...]
      reviews: Association to many Reviews on reviews.reviewee = $self;
}

entity Reviews : managed {
  key uuid: UUID
      reviewee: Association to Authors;
      rating: Integer;
  [...]
}

I specify the desired OData flavor explicitly in my .cdsrc.json file like this:

{
  "odata": {
    "flavor": "x4"
  }
}

Now, if I do a GET .../Reviews('43cf695f-4a13-4666-1240-d473f40fb23b') I would receive a response object like this one:

{
  "uuid": "43cf695f-4a13-4666-1240-d473f40fb23b",
  "reviewee": {
    "name": "John Doe"
  },
  "rating": 5
}

The cds-swagger-ui-express library instead generates a swagger UI with a response object like this:

{
  "uuid": "43cf695f-4a13-4666-1240-d473f40fb23b",
  "reviewee": "John Doe",
  "rating": 5
}

I guess the library cannot handle the custom OData flavor correctly in this case.

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

No branches or pull requests

1 participant