-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Suppress Pattern annotation on property of type byte array #19346
Merged
wing328
merged 3 commits into
OpenAPITools:master
from
tjquinno:helidon-byte-array-with-pattern
Aug 15, 2024
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
generatorName: java-helidon-server | ||
library: mp | ||
outputDir: samples/server/others/java-helidon-server/v3/mp-format-test | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/helidon/format-test.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/java-helidon/server | ||
additionalProperties: | ||
helidonVersion: 3.2.7 | ||
artifactId: format-helidon-server-mp | ||
hideGenerationTimestamp: "true" | ||
fullProject: "true" |
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,10 @@ | ||
generatorName: java-helidon-server | ||
library: mp | ||
outputDir: samples/server/others/java-helidon-server/v4/mp-format-test | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/helidon/format-test.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/java-helidon/server | ||
additionalProperties: | ||
helidonVersion: 4.0.11 | ||
artifactId: format-helidon-server-mp | ||
hideGenerationTimestamp: "true" | ||
fullProject: "true" |
2 changes: 1 addition & 1 deletion
2
...generator/src/main/resources/java-helidon/server/libraries/mp/beanValidationCore.mustache
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
36 changes: 36 additions & 0 deletions
36
modules/openapi-generator/src/test/resources/3_0/helidon/format-test.yaml
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,36 @@ | ||
openapi: 3.0.0 | ||
servers: | ||
- url: 'http://petstore.helidon.io:8080/format' | ||
info: | ||
description: >- | ||
This spec is mainly for testing Petstore server and contains fake endpoints, | ||
models. Please do not use this for any other purpose. For this sample, you can use the api key | ||
`special-key` to test the authorization filters. Special characters: " | ||
\ | ||
version: 1.0.0 | ||
title: OpenAPI Petstore | ||
license: | ||
name: Apache-2.0 | ||
url: 'https://www.apache.org/licenses/LICENSE-2.0.html' | ||
tags: | ||
- name: format | ||
description: Format tester | ||
paths: | ||
/format: | ||
get: | ||
operationId: simple | ||
responses: | ||
"200": | ||
content: {} | ||
description: success | ||
tags: | ||
- format | ||
|
||
components: | ||
schemas: | ||
format_test: | ||
properties: | ||
byte: | ||
format: byte | ||
pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$" | ||
type: string |
23 changes: 23 additions & 0 deletions
23
samples/server/others/java-helidon-server/v3/mp-format-test/.openapi-generator-ignore
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,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
13 changes: 13 additions & 0 deletions
13
samples/server/others/java-helidon-server/v3/mp-format-test/.openapi-generator/FILES
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,13 @@ | ||
README.md | ||
pom.xml | ||
src/main/java/org/openapitools/server/JavaTimeFormatter.java | ||
src/main/java/org/openapitools/server/RFC3339DateFormat.java | ||
src/main/java/org/openapitools/server/RestApplication.java | ||
src/main/java/org/openapitools/server/api/FormatService.java | ||
src/main/java/org/openapitools/server/api/FormatServiceImpl.java | ||
src/main/java/org/openapitools/server/model/FormatTest.java | ||
src/main/java/org/openapitools/server/package-info.java | ||
src/main/resources/META-INF/beans.xml | ||
src/main/resources/META-INF/microprofile-config.properties | ||
src/main/resources/META-INF/openapi.yml | ||
src/main/resources/logging.properties |
1 change: 1 addition & 0 deletions
1
samples/server/others/java-helidon-server/v3/mp-format-test/.openapi-generator/VERSION
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 @@ | ||
7.8.0-SNAPSHOT |
34 changes: 34 additions & 0 deletions
34
samples/server/others/java-helidon-server/v3/mp-format-test/README.md
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,34 @@ | ||
# Helidon Server with OpenAPI | ||
|
||
## Build and run | ||
|
||
With JDK11+ | ||
```bash | ||
mvn package | ||
java -jar target/format-helidon-server-mp.jar | ||
``` | ||
|
||
## Exercise the application | ||
|
||
``` | ||
curl -X GET http://petstore.helidon.io:8080/format | ||
|
||
``` | ||
|
||
## Try health and metrics | ||
|
||
``` | ||
curl -s -X GET http://petstore.helidon.io:8080/format/health | ||
{"outcome":"UP",... | ||
. . . | ||
|
||
# Prometheus Format | ||
curl -s -X GET http://petstore.helidon.io:8080/format/metrics | ||
# TYPE base:gc_g1_young_generation_count gauge | ||
. . . | ||
|
||
# JSON Format | ||
curl -H 'Accept: application/json' -X GET http://petstore.helidon.io:8080/format/metrics | ||
{"base":... | ||
. . . | ||
``` |
82 changes: 82 additions & 0 deletions
82
samples/server/others/java-helidon-server/v3/mp-format-test/pom.xml
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,82 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.openapitools</groupId> | ||
<parent> | ||
<groupId>io.helidon.applications</groupId> | ||
<artifactId>helidon-mp</artifactId> | ||
<version>3.2.7</version> | ||
<relativePath/> | ||
</parent> | ||
<artifactId>format-helidon-server-mp</artifactId> | ||
<name>format-helidon-server-mp</name> | ||
<description>This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. For this sample, you can use the api key `special-key` to test the authorization filters. Special characters: \" \\</description> | ||
<version>1.0.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<version.jackson.databind.nullable>0.2.6</version.jackson.databind.nullable> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.bundles</groupId> | ||
<artifactId>helidon-microprofile-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.cdi</groupId> | ||
<artifactId>helidon-microprofile-cdi</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.enterprise</groupId> | ||
<artifactId>jakarta.enterprise.cdi-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>jakarta.ws.rs</groupId> | ||
<artifactId>jakarta.ws.rs-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openapitools</groupId> | ||
<artifactId>jackson-databind-nullable</artifactId> | ||
<version>${version.jackson.databind.nullable}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jersey.media</groupId> | ||
<artifactId>jersey-media-json-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.helidon.microprofile.tests</groupId> | ||
<artifactId>helidon-microprofile-tests-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-libs</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jboss.jandex</groupId> | ||
<artifactId>jandex-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>make-index</id> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
64 changes: 64 additions & 0 deletions
64
...don-server/v3/mp-format-test/src/main/java/org/openapitools/server/JavaTimeFormatter.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,64 @@ | ||
/* | ||
* OpenAPI Petstore | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. For this sample, you can use the api key `special-key` to test the authorization filters. Special characters: \" \\ | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package org.openapitools.server; | ||
|
||
import java.time.OffsetDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
import java.time.format.DateTimeParseException; | ||
|
||
/** | ||
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class. | ||
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}. | ||
*/ | ||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaHelidonServerCodegen", comments = "Generator version: 7.8.0-SNAPSHOT") | ||
public class JavaTimeFormatter { | ||
|
||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; | ||
|
||
/** | ||
* Get the date format used to parse/format {@code OffsetDateTime} parameters. | ||
* @return DateTimeFormatter | ||
*/ | ||
public DateTimeFormatter getOffsetDateTimeFormatter() { | ||
return offsetDateTimeFormatter; | ||
} | ||
|
||
/** | ||
* Set the date format used to parse/format {@code OffsetDateTime} parameters. | ||
* @param offsetDateTimeFormatter {@code DateTimeFormatter} | ||
*/ | ||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) { | ||
this.offsetDateTimeFormatter = offsetDateTimeFormatter; | ||
} | ||
|
||
/** | ||
* Parse the given string into {@code OffsetDateTime} object. | ||
* @param str String | ||
* @return {@code OffsetDateTime} | ||
*/ | ||
public OffsetDateTime parseOffsetDateTime(String str) { | ||
try { | ||
return OffsetDateTime.parse(str, offsetDateTimeFormatter); | ||
} catch (DateTimeParseException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
/** | ||
* Format the given {@code OffsetDateTime} object into string. | ||
* @param offsetDateTime {@code OffsetDateTime} | ||
* @return {@code OffsetDateTime} in string format | ||
*/ | ||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) { | ||
return offsetDateTimeFormatter.format(offsetDateTime); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...don-server/v3/mp-format-test/src/main/java/org/openapitools/server/RFC3339DateFormat.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,50 @@ | ||
/* | ||
* OpenAPI Petstore | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. For this sample, you can use the api key `special-key` to test the authorization filters. Special characters: \" \\ | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package org.openapitools.server; | ||
|
||
import com.fasterxml.jackson.databind.util.StdDateFormat; | ||
|
||
import java.text.DateFormat; | ||
import java.text.FieldPosition; | ||
import java.text.ParsePosition; | ||
import java.util.Date; | ||
import java.util.GregorianCalendar; | ||
import java.util.TimeZone; | ||
|
||
public class RFC3339DateFormat extends DateFormat { | ||
private static final long serialVersionUID = 1L; | ||
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); | ||
|
||
private final StdDateFormat fmt = new StdDateFormat() | ||
.withTimeZone(TIMEZONE_Z) | ||
.withColonInTimeZone(true); | ||
|
||
public RFC3339DateFormat() { | ||
this.calendar = new GregorianCalendar(); | ||
} | ||
|
||
@Override | ||
public Date parse(String source, ParsePosition pos) { | ||
return fmt.parse(source, pos); | ||
} | ||
|
||
@Override | ||
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { | ||
return fmt.format(date, toAppendTo, fieldPosition); | ||
} | ||
|
||
@Override | ||
public Object clone() { | ||
return this; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...lidon-server/v3/mp-format-test/src/main/java/org/openapitools/server/RestApplication.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,11 @@ | ||
package org.openapitools.server; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.ws.rs.ApplicationPath; | ||
import jakarta.ws.rs.core.Application; | ||
|
||
@ApplicationScoped | ||
@ApplicationPath("/format") | ||
public class RestApplication extends Application { | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...don-server/v3/mp-format-test/src/main/java/org/openapitools/server/api/FormatService.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,30 @@ | ||
/* | ||
* OpenAPI Petstore | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. For this sample, you can use the api key `special-key` to test the authorization filters. Special characters: \" \\ | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
package org.openapitools.server.api; | ||
|
||
|
||
import jakarta.ws.rs.*; | ||
|
||
import java.io.InputStream; | ||
import java.util.Map; | ||
import java.util.List; | ||
import jakarta.validation.constraints.*; | ||
import jakarta.validation.Valid; | ||
|
||
@Path("/format") | ||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaHelidonServerCodegen", comments = "Generator version: 7.8.0-SNAPSHOT") | ||
public interface FormatService { | ||
|
||
@GET | ||
void simple(); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we add the new sample folders to the github workflow so that these will be tested moving forward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch. I'll push another commit right away.