Skip to content

RegEx Matching #2

@boosey

Description

@boosey

I am trying to fold all the OpenApi annotations in java code such as:
@post
@operation(summary = "Create contacts",
description = "Creates one or more contacts. Accepts a batch of new contact requests in the request body. Each contact will be validated and processed.")
@RequestBody(description = "Batch of new contacts to create", required = true,
content = @content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = NewContactBatchRequest.class)))
@APIResponses({
@apiresponse(responseCode = "204",
description = "Contacts created successfully. No content returned."),
@apiresponse(responseCode = "400", description = "Invalid input",
content = @content(mediaType = MediaType.APPLICATION_JSON,
schema = @Schema(implementation = ErrorResponse.class)))})
public void createContacts(@Valid NewContactBatchRequest batchRequest) {
....
}

It is unclear how to formulate the regex. For the APIResponses stanza, I have this: ^\s*@APIResponses\(\s*\{[\s\S]?^\s\}\)
I think it should match from '@APIResponses(' to the final ')'. Thus, folding all 6 lines. However, this is not matching. I am not sure if the extension can do this across lines??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions