-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[plugins/zdl-to-openapi] adds support for
operationIdsToInclude
and…
… `operationIdsToExclude` supporting ant-style wildcard matching.
- Loading branch information
Showing
9 changed files
with
191 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
plugins/zdl-to-openapi/src/test/java/io/zenwave360/sdk/plugins/PathsProcessorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.zenwave360.sdk.plugins; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
import io.zenwave360.sdk.parsers.ZDLParser; | ||
import io.zenwave360.sdk.processors.ZDLProcessor; | ||
import io.zenwave360.sdk.templating.TemplateOutput; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class PathsProcessorTest { | ||
|
||
|
||
ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); | ||
|
||
private Map<String, Object> loadZDLModelFromResource(String resource) throws Exception { | ||
Map<String, Object> model = new ZDLParser().withZdlFile(resource).parse(); | ||
model = new ZDLProcessor().process(model); | ||
return model; | ||
} | ||
|
||
@Test | ||
public void test_process_inline_parameters() throws Exception { | ||
Map<String, Object> model = loadZDLModelFromResource("classpath:inline-parameters.zdl"); | ||
model = new PathsProcessor().process(model); | ||
List<Map<String, Object>> paths = (List<Map<String, Object>>) model.get("paths"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
plugins/zdl-to-openapi/src/test/resources/inline-parameters.zdl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@aggregate | ||
entity MetricRecord { | ||
|
||
} | ||
|
||
|
||
@inline | ||
input MetricsSummarySearchCriteria { | ||
hisNumber String required maxlength(100) | ||
} | ||
|
||
@inline | ||
input MetricsSearchCriteria { | ||
hisNumber String required maxlength(100) | ||
dateFrom LocalDateTime | ||
dateTo LocalDateTime | ||
} | ||
|
||
output Metric { | ||
|
||
} | ||
|
||
@rest("/metrics") | ||
service MedicalRecordService for (MetricRecord) { | ||
// esto es para la webapp | ||
@get("/{hisNumber}/daily") @paginated | ||
getDailyMetrics(MetricsSearchCriteria) Metric[] | ||
// esto es para la webapp | ||
@get("/{hisNumber}/frequently") @paginated | ||
getFrequestMetrics(MetricsSearchCriteria) Metric[] | ||
|
||
/** | ||
* Summary metrics for mobile | ||
*/ | ||
@get("/{hisNumber}/summary") | ||
getMetricsSummary(MetricsSummarySearchCriteria) Metric[] | ||
} |
15 changes: 15 additions & 0 deletions
15
zenwave-sdk-cli/src/main/java/io/zenwave360/sdk/utils/AntStyleMatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.zenwave360.sdk.utils; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public class AntStyleMatcher { | ||
|
||
public static boolean match(String pattern, String filePath) { | ||
// Convert Ant-style pattern to regex | ||
String regex = pattern | ||
.replace("**", ".*") | ||
.replace("*", "[^/]*") | ||
.replace("?", "."); | ||
return Pattern.matches(regex, filePath); | ||
} | ||
} |
Oops, something went wrong.