Skip to content

Commit

Permalink
openapi 学习
Browse files Browse the repository at this point in the history
  • Loading branch information
landy committed Jul 17, 2018
1 parent 2bb190c commit ba07379
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
27 changes: 27 additions & 0 deletions learn-openapi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http:https://maven.apache.org/POM/4.0.0"
xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:https://maven.apache.org/POM/4.0.0 http:https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>daydayup</artifactId>
<groupId>com.github.landyking</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>learn-openapi</artifactId>

<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<inputSpec>${pom.basedir}/src/openapi/securityApiKey.yaml</inputSpec>
<generatorName>spring</generatorName>
</configuration>
</plugin>
</plugins>
</build>
</project>
73 changes: 73 additions & 0 deletions learn-openapi/src/openapi/securityApiKey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
openapi: 3.0.0
info:
title: test security
description: how to config security
version: 1.0.1

servers:
- url: http:https://192.168.50.133:4010
description: mock server
paths:
/login:
post:
summary: login api
security: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
username:
description: 密码
type: string
example: 'user001'
password:
description: 账号
type: string
format: password
example: '000000'
responses:
200:
description: login result
headers:
itoken:
schema:
type: string
example: 'uuid-uuid-uuid-uuid'
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
message:
type: string
example: 'ok'

/test:
get:
summary: first api
description: first api description
responses:
'200':
description: success result
content:
application/json:
schema:
type: object
properties:
success:
type: boolean

components:
securitySchemes:
apiKeyAuth:
type: apiKey
in: header
name: itoken

security:
- apiKeyAuth: []
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<module>learn-mybatis3</module>
<module>learn-xml</module>
<module>learn-springel</module>
<module>learn-openapi</module>
</modules>
<packaging>pom</packaging>

Expand Down

0 comments on commit ba07379

Please sign in to comment.