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

[Bug]: Unable to generate openapi spec #229

Open
prashanth-hegde opened this issue May 22, 2023 · 0 comments
Open

[Bug]: Unable to generate openapi spec #229

prashanth-hegde opened this issue May 22, 2023 · 0 comments
Labels

Comments

@prashanth-hegde
Copy link

prashanth-hegde commented May 22, 2023

Description

Unable to create an openapi spec as specified in the help docs here
https://ballerina.io/learn/openapi-tool/

Steps to Reproduce

bal new -t service hello_service
cd hello_service
bal build 
bal openapi -i service.bal -o api.yml

Get the below error

[I] [hello_service] bal openapi -i service.bal -o api.yml
ballerina: Oh no, something really went wrong. Bad. Sad.

We appreciate it if you can report the code that broke Ballerina in
https://github.com/ballerina-platform/ballerina-lang/issues with the
log you get below and your sample code.

We thank you for helping make us better.

[2023-05-22 10:37:01,705] SEVERE {b7a.log.crash} - Format specifier '%s' 
java.util.MissingFormatArgumentException: Format specifier '%s'
        at java.base/java.util.Formatter.format(Formatter.java:2672)
        at java.base/java.util.Formatter.format(Formatter.java:2609)
        at java.base/java.lang.String.format(String.java:2897)
        at io.ballerina.openapi.converter.diagnostic.ExceptionDiagnostic.<init>(ExceptionDiagnostic.java:38)
        at io.ballerina.openapi.cmd.OASContractGenerator.generateOAS3DefinitionsAllService(OASContractGenerator.java:137)
        at io.ballerina.openapi.cmd.OpenApiCmd.ballerinaToOpenApi(OpenApiCmd.java:231)
        at io.ballerina.openapi.cmd.OpenApiCmd.execute(OpenApiCmd.java:195)
        at java.base/java.util.Optional.ifPresent(Optional.java:183)
        at io.ballerina.cli.launcher.Main.main(Main.java:51)

Source (service.bal)

import ballerina/http;

# A service representing a network-accessible API
# bound to port `9090`.
service / on new http:Listener(9090) {

    # A resource for generating greetings
    # + name - the input string name
    # + return - string name with hello message or error
    resource function get greeting(string name) returns string|error {
        // Send a response back to the caller.
        if name is "" {
            return error("name should not be empty!");
        }
        return "Hello, " + name;
    }
}

Affected Version(s)

MacOs Ventura 13.2.1 M1 (aarch64)

[I] [hello_service] bal version 
Ballerina 2201.5.0 (Swan Lake Update 5)
Language specification 2022R4
Update Tool 1.3.14

OS, DB, other environment details and versions

No response

Related area

-> API Docs

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@ballerina-bot ballerina-bot transferred this issue from ballerina-platform/ballerina-lang May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant