feat: Schema
This commit is contained in:
parent
3edf1cfb27
commit
2a3bfb3a5b
3 changed files with 51 additions and 1 deletions
19
pom.xml
19
pom.xml
|
@ -30,6 +30,7 @@
|
||||||
<!-- dependencies -->
|
<!-- dependencies -->
|
||||||
|
|
||||||
<!-- plugins -->
|
<!-- plugins -->
|
||||||
|
<jsonschema2pojo.version>1.2.1</jsonschema2pojo.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -66,6 +67,24 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jsonschema2pojo</groupId>
|
||||||
|
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
|
||||||
|
<version>${jsonschema2pojo.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<sourceDirectory>${basedir}/schema</sourceDirectory>
|
||||||
|
<targetPackage>eu.ztsh.lfr.model</targetPackage>
|
||||||
|
<useBigDecimals>true</useBigDecimals>
|
||||||
|
<includeAdditionalProperties>false</includeAdditionalProperties>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,13 @@ Write an application that, at the endpoint specified by you, returns the yearly
|
||||||
[example_file.csv](example_file.csv)
|
[example_file.csv](example_file.csv)
|
||||||
|
|
||||||
|
|
||||||
## Example response
|
## Response
|
||||||
|
|
||||||
|
### Schema
|
||||||
|
[response_schema](schema/response.json)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
|
25
schema/response.json
Normal file
25
schema/response.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"$id": "https://ztsh.eu/lfr/response.json",
|
||||||
|
"$schema": "http://json-schema.org/draft/2020-12/schema",
|
||||||
|
"type": "array",
|
||||||
|
"def": {
|
||||||
|
"entry": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"year": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"averageTemperature": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"year",
|
||||||
|
"averageTemperature"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/def/entry"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue