Skip to content

Commit 0e66740

Browse files
committed
Import raft model.
1 parent e557106 commit 0e66740

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

raft/mircoraft/pom.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,33 @@
8686
<goal>generate</goal>
8787
</goals>
8888
<configuration>
89-
<skipValidateSpec>true</skipValidateSpec>
89+
<skipValidateSpec>false</skipValidateSpec>
9090
<inputSpec>./src/main/resources/openapi/microraft.yml</inputSpec>
9191
<generatorName>spring</generatorName>
92+
<apiPackage>com.baeldung.openapi.api</apiPackage>
93+
<modelPackage>com.baeldung.openapi.model</modelPackage>
9294
<configOptions>
95+
<delegatePattern>true</delegatePattern>
9396
<openApiNullable>false</openApiNullable>
9497
<interfaceOnly>true</interfaceOnly>
9598
</configOptions>
99+
<!--
100+
https://stackoverflow.com/questions/65336977/openapi-3-0-a-reference-to-the-existing-class
101+
-->
102+
<importMappings>
103+
<importMapping>VoteRequest=io.microraft.model.message.VoteRequest</importMapping>
104+
<importMapping>VoteResponse=io.microraft.model.message.VoteResponse</importMapping>
105+
</importMappings>
96106
</configuration>
97107
</execution>
98108
</executions>
109+
<dependencies>
110+
<dependency>
111+
<groupId>io.microraft</groupId>
112+
<artifactId>microraft</artifactId>
113+
<version>0.7</version>
114+
</dependency>
115+
</dependencies>
99116
</plugin>
100117

101118
<plugin>

raft/mircoraft/src/main/resources/openapi/microraft.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,30 @@ servers:
1111
- url: https://prodenvironment.org/api/v1
1212
tags:
1313
- name: accounts
14-
description: Operations between bank accounts
14+
description: Operations between bank accounts
15+
paths:
16+
/raft:
17+
get:
18+
requestBody:
19+
$ref: '#/components/requestBodies/RaftPayloadBody'
20+
responses:
21+
200:
22+
description: 'Updated'
23+
24+
components:
25+
requestBodies: # https://swagger.io/docs/specification/describing-request-body/
26+
RaftPayloadBody:
27+
description: 'The Raft protocol body'
28+
required: true
29+
content:
30+
application/json:
31+
schema:
32+
oneOf:
33+
- $ref: 'VoteRequest'
34+
- $ref: 'VoteResponse'
35+
schemas:
36+
MyVoteRequest:
37+
type:
38+
properties:
39+
foo:
40+
$ref: 'VoteRequest'

0 commit comments

Comments
 (0)