Skip to content

Commit

Permalink
updated swagger core and swagger parser versions, also added tests to…
Browse files Browse the repository at this point in the history
… confirm that issue swagger-api#7980 is solved with these changes.
  • Loading branch information
HugoMario committed May 23, 2018
1 parent e3f69c0 commit 4408b99
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.swagger.codegen;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.Operation;
import io.swagger.models.Swagger;
import io.swagger.models.properties.Property;
Expand Down Expand Up @@ -431,4 +432,12 @@ public void deprecatedParamTest() {

Assert.assertTrue(op.isDeprecated);
}

@Test(description = "https://github.com/swagger-api/swagger-codegen/issues/7980")
public void testPattern() throws Exception {
final Swagger swagger = parseAndPrepareSwagger("src/test/resources/2_0/petstore.yaml");
ModelImpl currency = (ModelImpl) swagger.getDefinitions().get("Currency");
Assert.assertNotNull(currency);
Assert.assertEquals(currency.getPattern(), "^[A-Z]{3,3}$");
}
}
23 changes: 23 additions & 0 deletions modules/swagger-codegen/src/test/resources/2_0/petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,29 @@ definitions:
type: string
message:
type: string
#issue: https://github.com/swagger-api/swagger-codegen/issues/7980
Amount:
type: object
description: >
some description
properties:
value:
format: double
type: number
minimum: 0.01
maximum: 1000000000000000
description: >
some description
currency:
$ref: '#/definitions/Currency'
required:
- value
- currency
Currency:
type: string
pattern: '^[A-Z]{3,3}$'
description: >
some description
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -933,10 +933,10 @@
</repository>
</repositories>
<properties>
<swagger-parser-version>1.0.34</swagger-parser-version>
<swagger-parser-version>1.0.36-SNAPSHOT</swagger-parser-version>
<scala-version>2.11.1</scala-version>
<felix-version>3.3.0</felix-version>
<swagger-core-version>1.5.18</swagger-core-version>
<swagger-core-version>1.5.20-SNAPSHOT</swagger-core-version>
<commons-io-version>2.4</commons-io-version>
<commons-cli-version>1.2</commons-cli-version>
<junit-version>4.8.1</junit-version>
Expand Down

0 comments on commit 4408b99

Please sign in to comment.