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 and http:Header mapping for record fields in the OpenAPI generation #1773

Merged
merged 12 commits into from
Sep 24, 2024

Conversation

TharmiganK
Copy link
Contributor

@TharmiganK TharmiganK commented Sep 20, 2024

Purpose

$Subject

Fixes: ballerina-platform/ballerina-library#7014

This PR also address the mapping for header annotation with a record type:

import ballerina/data.jsondata;
import ballerina/http;

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

public type Headers record {|
    @http:Header {name: "X-API-VERSION"}
    string? apiVersion = "v1";
|};

@http:ServiceConfig {basePath: "/api/v1"}
type OASServiceType service object {
    *http:ServiceContract;
    resource function get albums(@http:Header Headers headers) returns Album[];
};
...
  /albums:
    get:
      operationId: getAlbums
      parameters:
      - name: X-API-VERSION
        in: header
        schema:
          type: string
          nullable: true
          default: v1
...

@TharmiganK TharmiganK changed the title Add jsondata name attribute mapping in the OpenAPI generation Add jsondata:Name and http:Header mapping for record fields in the OpenAPI generation Sep 20, 2024
@TharmiganK TharmiganK marked this pull request as ready for review September 23, 2024 05:39
daneshk
daneshk previously approved these changes Sep 23, 2024
lnash94
lnash94 previously approved these changes Sep 23, 2024
Copy link

@lnash94 lnash94 merged commit 3434ba6 into master Sep 24, 2024
3 checks passed
@TharmiganK TharmiganK deleted the json-data-name branch September 24, 2024 10:52
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.

Add jsondata name attribute mapping in the OpenAPI generation
4 participants