ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 64 forks source link

OpenAPI related annotations should not be allowed in the services which are implemented via the service contract type #7336

Open TharmiganK opened 2 weeks ago

TharmiganK commented 2 weeks ago

Description

When a service is implemented via the HTTP service contract type, none of the HTTP annotations are allowed in the service implementation. For consistency, this should be applied for the OpenAPI annotations as well.

Steps to Reproduce

The following should not be allowed:

// UsersService is a service contract type
service UsersService on new http:Listener(9090) {

    // This should not be allowed
    @openapi:ResourceInfo {
        summary: "This is a resource function which can be used to get the path"
    }
    resource function post users/[string id]("approved"|"pending"|"closed"|"new" status, User user) returns User {
        return user;
    }
}

Version

Ballerina SwanLake Update 10(2201.10.0)

Environment Details (with versions)

No response