Suppress Pattern annotation on property of type byte array (#19346)

* Suppress Pattern annotation on property of type byte array

Signed-off-by: Tim Quinn <tim.quinn@oracle.com>

* Straggler files from generated samples

* Add new format test to workflows

---------

Signed-off-by: Tim Quinn <tim.quinn@oracle.com>
This commit is contained in:
Tim Quinn 2024-08-15 04:09:44 -05:00 committed by GitHub
parent 024bbb7784
commit cd02426648
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
40 changed files with 1122 additions and 1 deletions

View File

@ -5,10 +5,12 @@ on:
paths:
- samples/client/petstore/java-helidon-client/v3/**
- samples/server/petstore/java-helidon-server/v3/**
- samples/server/others/java-helidon-server/v3/**
pull_request:
paths:
- samples/client/petstore/java-helidon-client/v3/**
- samples/server/petstore/java-helidon-server/v3/**
- samples/server/others/java-helidon-server/v3/**
jobs:
build:
name: Build Java Helidon
@ -21,6 +23,7 @@ jobs:
- samples/client/petstore/java-helidon-client/v3/se
- samples/server/petstore/java-helidon-server/v3/mp
- samples/server/petstore/java-helidon-server/v3/se
- samples/server/others/java-helidon-server/v3/mp-format-test
version: [17]
steps:
- uses: actions/checkout@v4

View File

@ -5,10 +5,12 @@ on:
paths:
- samples/client/petstore/java-helidon-client/v4/**
- samples/server/petstore/java-helidon-server/v4/**
- samples/server/others/java-helidon-server/v4/**
pull_request:
paths:
- samples/client/petstore/java-helidon-client/v4/**
- samples/server/petstore/java-helidon-server/v4/**
- samples/server/others/java-helidon-server/v4/**
jobs:
build:
name: Build Java Helidon
@ -22,6 +24,7 @@ jobs:
- samples/server/petstore/java-helidon-server/v4/mp
- samples/server/petstore/java-helidon-server/v4/se
- samples/server/petstore/java-helidon-server/v4/se-uac
- samples/server/others/java-helidon-server/v4/mp-format-test
version: [21]
steps:
- uses: actions/checkout@v4

View File

@ -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"

View File

@ -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"

View File

@ -1,4 +1,4 @@
{{#pattern}} @Pattern(regexp="{{{.}}}"){{/pattern}}{{!
{{#pattern}}{{^isByteArray}} @Pattern(regexp="{{{.}}}"){{/isByteArray}}{{/pattern}}{{!
minLength && maxLength set
}}{{#minLength}}{{#maxLength}} @Size(min={{minLength}},max={{maxLength}}){{/maxLength}}{{/minLength}}{{!
minLength set, maxLength not

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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":...
. . .
```

View File

@ -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 &#x60;special-key&#x60; to test the authorization filters. Special characters: \&quot; \\</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>

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -0,0 +1,32 @@
/*
* 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 class FormatServiceImpl implements FormatService {
@GET
public void simple() {
}
}

View File

@ -0,0 +1,74 @@
/*
* 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.model;
import com.fasterxml.jackson.annotation.JsonTypeName;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
public class FormatTest {
private byte[] _byte;
/**
* Get _byte
* @return _byte
**/
public byte[] getByte() {
return _byte;
}
/**
* Set _byte
**/
public void setByte(byte[] _byte) {
this._byte = _byte;
}
public FormatTest _byte(byte[] _byte) {
this._byte = _byte;
return this;
}
/**
* Create a string representation of this pojo.
**/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FormatTest {\n");
sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
version="2.0"
bean-discovery-mode="annotated">
</beans>

View File

@ -0,0 +1,11 @@
# Microprofile server properties
# Application properties. This is the default greeting
app.greeting=Hello
# Microprofile server properties
server.port=8080
server.host=0.0.0.0
# Enable the optional MicroProfile Metrics REST.request metrics
metrics.rest-request.enabled=true

View File

@ -0,0 +1,36 @@
openapi: 3.0.0
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: \" \\"
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore
version: 1.0.0
servers:
- url: http://petstore.helidon.io:8080/format
tags:
- description: Format tester
name: format
paths:
/format:
get:
operationId: simple
responses:
"200":
content: {}
description: success
tags:
- format
x-accepts:
- application/json
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

View File

@ -0,0 +1,19 @@
# Example Logging Configuration File
# For more information see $JAVA_HOME/jre/lib/logging.properties
# Send messages to the console
handlers=io.helidon.common.HelidonConsoleHandler
# HelidonConsoleHandler uses a SimpleFormatter subclass that replaces "!thread!" with the current thread
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n
# Global logging level. Can be overridden by specific loggers
.level=INFO
# Component specific log levels
#io.helidon.webserver.level=INFO
#io.helidon.config.level=INFO
#io.helidon.security.level=INFO
#io.helidon.common.level=INFO
#io.netty.level=INFO

View File

@ -0,0 +1,40 @@
/*
* 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.model;
import com.fasterxml.jackson.annotation.JsonTypeName;
import org.junit.jupiter.api.Test;
/**
* Model tests for FormatTest
*/
public class FormatTestTest {
private final FormatTest model = new FormatTest();
/**
* Model tests for FormatTest
*/
@Test
public void testFormatTest() {
// TODO: test FormatTest
}
/**
* Test the property '_byte'
*/
@Test
public void _byteTest() {
// TODO: test _byte
}
}

View File

@ -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

View File

@ -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

View File

@ -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":...
. . .
```

View File

@ -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>4.0.11</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 &#x60;special-key&#x60; to test the authorization filters. Special characters: \&quot; \\</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.testing</groupId>
<artifactId>helidon-microprofile-testing-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>io.smallrye</groupId>
<artifactId>jandex-maven-plugin</artifactId>
<executions>
<execution>
<id>make-index</id>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -0,0 +1,32 @@
/*
* 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 class FormatServiceImpl implements FormatService {
@GET
public void simple() {
}
}

View File

@ -0,0 +1,74 @@
/*
* 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.model;
import com.fasterxml.jackson.annotation.JsonTypeName;
import jakarta.validation.constraints.*;
import jakarta.validation.Valid;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
public class FormatTest {
private byte[] _byte;
/**
* Get _byte
* @return _byte
**/
public byte[] getByte() {
return _byte;
}
/**
* Set _byte
**/
public void setByte(byte[] _byte) {
this._byte = _byte;
}
public FormatTest _byte(byte[] _byte) {
this._byte = _byte;
return this;
}
/**
* Create a string representation of this pojo.
**/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class FormatTest {\n");
sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private static String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
version="2.0"
bean-discovery-mode="annotated">
</beans>

View File

@ -0,0 +1,11 @@
# Microprofile server properties
# Application properties. This is the default greeting
app.greeting=Hello
# Microprofile server properties
server.port=8080
server.host=0.0.0.0
# Enable the optional MicroProfile Metrics REST.request metrics
metrics.rest-request.enabled=true

View File

@ -0,0 +1,36 @@
openapi: 3.0.0
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: \" \\"
license:
name: Apache-2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
title: OpenAPI Petstore
version: 1.0.0
servers:
- url: http://petstore.helidon.io:8080/format
tags:
- description: Format tester
name: format
paths:
/format:
get:
operationId: simple
responses:
"200":
content: {}
description: success
tags:
- format
x-accepts:
- application/json
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

View File

@ -0,0 +1,18 @@
# Example Logging Configuration File
# For more information see $JAVA_HOME/jre/lib/logging.properties
# Send messages to the console
handlers=java.util.logging.ConsoleHandler
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS %4$s %3$s !thread!: %5$s%6$s%n
# Global logging level. Can be overridden by specific loggers
.level=INFO
# Component specific log levels
#io.helidon.webserver.level=INFO
#io.helidon.config.level=INFO
#io.helidon.security.level=INFO
#io.helidon.common.level=INFO
#io.netty.level=INFO

View File

@ -0,0 +1,40 @@
/*
* 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.model;
import com.fasterxml.jackson.annotation.JsonTypeName;
import org.junit.jupiter.api.Test;
/**
* Model tests for FormatTest
*/
public class FormatTestTest {
private final FormatTest model = new FormatTest();
/**
* Model tests for FormatTest
*/
@Test
public void testFormatTest() {
// TODO: test FormatTest
}
/**
* Test the property '_byte'
*/
@Test
public void _byteTest() {
// TODO: test _byte
}
}