ballerina-platform / ballerina-spec

Ballerina Language and Platform Specifications
Other
167 stars 53 forks source link

Introduce an annotation attachment point for service object type descriptor #1305

Open TharmiganK opened 5 months ago

TharmiganK commented 5 months ago

Description:

We have a requirement to add an annotation on the service object type descriptor nodes. But currently there is no such attachment point in the spec, so I need to enable the annotation on all type descriptor nodes and do a validation through a custom compiler plugin.

@openapi:ServiceConfig {
   basePath: "social-media"
}
type SocialMedia service object {
    *http:Service;
    resource function get users() returns User[]|error;
    resource function get users/[int id]() returns User|UserNotFound|error;
    resource function post users(NewUser newUser) returns http:Created|error;
    resource function delete users/[int id]() returns http:NoContent|error;
};

Related Issues: [Proposal] Map OpenAPI Specification (OAS) to service object type