test: NBP rates model

This commit is contained in:
Piotr Dec 2024-05-23 18:41:51 +02:00
parent b5237c49bc
commit d6e9136a68
Signed by: stawros
GPG key ID: F89F27AD8F881A91
3 changed files with 71 additions and 1 deletions

View file

@ -6,5 +6,5 @@ indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.yaml]
[{*.yaml,*.json}]
indent_size = 2

17
pom.xml
View file

@ -29,6 +29,7 @@
<!-- dependencies -->
<!-- plugins -->
<jsonschema2pojo.version>1.2.1</jsonschema2pojo.version>
</properties>
<dependencies>
@ -85,6 +86,22 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>${jsonschema2pojo.version}</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<targetPackage>eu.ztsh.wymiana.model</targetPackage>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

View file

@ -0,0 +1,53 @@
{
"$id": "https://api.nbp.pl/c/rates.json",
"$schema": "http://json-schema.org/draft/2020-12/schema",
"type": "object",
"def": {
"rate": {
"type": "object",
"properties": {
"no": {
"type": "string"
},
"effectiveDate": {
"type": "string"
},
"bid": {
"type": "number"
},
"ask": {
"type": "number"
}
},
"required": [
"no",
"effectiveDate",
"bid",
"ask"
]
}
},
"properties": {
"table": {
"type": "string"
},
"currency": {
"type": "string"
},
"code": {
"type": "string"
},
"rates": {
"type": "array",
"items": {
"$ref": "#/def/rate"
}
}
},
"required": [
"table",
"currency",
"code",
"rates"
]
}