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

Make consistence with the ballerina resource API documentation Mapping for OAS to Service generation and Service to OAS generation #7337

Open
lnash94 opened this issue Nov 6, 2024 · 0 comments

Comments

@lnash94
Copy link
Member

lnash94 commented Nov 6, 2024

Description

Currently, we are mapping the OpenAPI Specification (OAS) summary to the Ballerina service and client API documentation. When the Ballerina service or client has API documentation, we map it to the OAS summary.

We have observed inconsistent mapping between the OAS and Ballerina. If the user provides only a description, it is mapped as API documentation, which can be problematic when generating OAS for that specific service. This inconsistency may lead to the description being mapped to the summary instead of the intended description field in the OAS.

Solution:

  1. Use only the summary for OAS-to-Ballerina service generation and Ballerina service-to-OAS mapping.
  2. If the summary is absent, API documentation will not be generated.

Steps to Reproduce

Use the below OAS and generate the Ballerina service, using bal openapi -i <yml> --mode service

openapi: 3.0.0
info:
  title: Sample API
  description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
  version: 0.1.9

servers:
  - url: http://api.example.com/v1
    description: Optional server description, e.g. Main (production) server
  - url: http://staging-api.example.com
    description: Optional server description, e.g. Internal staging server for testing

paths:
  /users:
    get:
      summary: Returns a list of users.
      description: Optional extended description in CommonMark or HTML.
      responses:
        "200": # status code
          description: A JSON array of user names
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string

**Note: Please make sure to check with both the service contract type and service declaration node

Version

2201.10.1

Environment Details (with versions)

No response

@lnash94 lnash94 changed the title Make consistence with the openapi:ResourceConfig{} and ballerina resource API documentation Mapping Make consistence with the ballerina resource API documentation Mapping for OAS to Service generation and Service to OAS generation Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: BackLog
Development

No branches or pull requests

1 participant