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 jsondata name attribute mapping in the OpenAPI generation #7014

Open
1 task done
TharmiganK opened this issue Sep 20, 2024 · 0 comments · May be fixed by ballerina-platform/openapi-tools#1773
Open
1 task done
Assignees
Labels

Comments

@TharmiganK
Copy link
Contributor

TharmiganK commented Sep 20, 2024

Description:

With the implementation of this proposal, the data-binding will be supported with the jsondata name attribute in HTTP. This has an impact on the generated OpenAPI specification from the service.

Consider the following type definition:

public type Album record {|
    string artist;
    @jsondata:Name {value: "_id"}
    string id;
    string title;
|};

This is currently mapped to the following schema:

Album:
  required:
    - id
    - artist
    - title
  type: object
  properties:
    id:
      type: string
    title:
      type: string
    artist:
      type: string
  additionalProperties: false

But according to the jsondata annotation, the field id should be considered as _id. So the new schema definition should look like this:

Album:
  required:
    - _id
    - artist
    - title
  type: object
  properties:
    _id:
      type: string
    title:
      type: string
    artist:
      type: string
  additionalProperties: false

Describe your task(s)

  • Add jsondata name attribute mapping in the generated schema name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
1 participant