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

Fixes parsing "entity_table_name" #3

Merged
merged 2 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/antlr4/io.github.zenwave360.zdl.antlr/Zdl.g4
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ option_value: complex_value;

// entities
entity: javadoc? annotations ENTITY entity_definition entity_body;
entity_definition: entity_name entity_table_name?;
entity_definition: entity_name (LPAREN entity_table_name RPAREN)?;
entity_name: keyword;
entity_table_name: LPAREN keyword RPAREN;
entity_table_name: keyword;
entity_body: LBRACE fields RBRACE;

fields: (field COMMA?)*;
field: javadoc? annotations field_name field_type entity_table_name? (field_validations)* suffix_javadoc? (nested_field)?;
field: javadoc? annotations field_name field_type (LPAREN entity_table_name RPAREN)? (field_validations)* suffix_javadoc? (nested_field)?;
nested_field: LBRACE (field)* RBRACE nested_field_validations*;
field_name: keyword;
field_type: ID | ID ARRAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public void enterConfig_option(io.github.zenwave360.zdl.antlr.ZdlParser.Config_o

@Override
public void enterApi(io.github.zenwave360.zdl.antlr.ZdlParser.ApiContext ctx) {
var name = ctx.api_name().getText();
var type = ctx.api_type().getText();
var role = ctx.api_role().getText();
var name = getText(ctx.api_name());
var type = getText(ctx.api_type());
var role = getText(ctx.api_role(), "provider");
var javadoc = javadoc(ctx.javadoc());
currentStack.push(new FluentMap()
.with("name", name)
Expand Down
12 changes: 6 additions & 6 deletions src/test/resources/simple.zdl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ config {
apis {

/** Customer API javadoc comment */
asyncapi(client) BASA {
uri 'classpath:/basa-asyncapi.yml'
consumerPackage 'com.basa.consumer'
modelPackage 'com.basa.model'
asyncapi(client) BRASA {
uri 'classpath:/BRASA-asyncapi.yml'
consumerPackage 'com.brasa.consumer'
modelPackage 'com.brasa.model'
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ service CustomerService for (Customer) {
* Create customer javadoc comment
*/
@post("/customers")
@inbound({ api: "BASA", operationId: "createCustomer"})
@inbound({ api: "BRASA", operationId: "createCustomer"})
@query({api: "doxis", operationId: "createCustomer"})
createCustomer(CustomerInput) Customer withEvents CustomerEvent [CustomerCreated|CustomerCreatedFailed]

Expand All @@ -135,7 +135,7 @@ event CustomerCreated {
customer Customer
}

@asyncapi({ api: 'BASA', operationId: 'createCustomer', topic: 'tratra' })
@asyncapi({ api: 'BRASA', operationId: 'createCustomer', topic: 'tratra' })
event CustomerUpdated {
customerId String
customer CustomerPayload {
Expand Down