Skip to content

Commit 4408b99

Browse files
committed
updated swagger core and swagger parser versions, also added tests to confirm that issue #7980 is solved with these changes.
1 parent e3f69c0 commit 4408b99

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

modules/swagger-codegen/src/test/java/io/swagger/codegen/CodegenTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.swagger.codegen;
22

33
import io.swagger.models.Model;
4+
import io.swagger.models.ModelImpl;
45
import io.swagger.models.Operation;
56
import io.swagger.models.Swagger;
67
import io.swagger.models.properties.Property;
@@ -431,4 +432,12 @@ public void deprecatedParamTest() {
431432

432433
Assert.assertTrue(op.isDeprecated);
433434
}
435+
436+
@Test(description = "https://github.com/swagger-api/swagger-codegen/issues/7980")
437+
public void testPattern() throws Exception {
438+
final Swagger swagger = parseAndPrepareSwagger("src/test/resources/2_0/petstore.yaml");
439+
ModelImpl currency = (ModelImpl) swagger.getDefinitions().get("Currency");
440+
Assert.assertNotNull(currency);
441+
Assert.assertEquals(currency.getPattern(), "^[A-Z]{3,3}$");
442+
}
434443
}

modules/swagger-codegen/src/test/resources/2_0/petstore.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,29 @@ definitions:
702702
type: string
703703
message:
704704
type: string
705+
#issue: https://github.com/swagger-api/swagger-codegen/issues/7980
706+
Amount:
707+
type: object
708+
description: >
709+
some description
710+
properties:
711+
value:
712+
format: double
713+
type: number
714+
minimum: 0.01
715+
maximum: 1000000000000000
716+
description: >
717+
some description
718+
currency:
719+
$ref: '#/definitions/Currency'
720+
required:
721+
- value
722+
- currency
723+
Currency:
724+
type: string
725+
pattern: '^[A-Z]{3,3}$'
726+
description: >
727+
some description
705728
externalDocs:
706729
description: Find out more about Swagger
707730
url: 'http://swagger.io'

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,10 +933,10 @@
933933
</repository>
934934
</repositories>
935935
<properties>
936-
<swagger-parser-version>1.0.34</swagger-parser-version>
936+
<swagger-parser-version>1.0.36-SNAPSHOT</swagger-parser-version>
937937
<scala-version>2.11.1</scala-version>
938938
<felix-version>3.3.0</felix-version>
939-
<swagger-core-version>1.5.18</swagger-core-version>
939+
<swagger-core-version>1.5.20-SNAPSHOT</swagger-core-version>
940940
<commons-io-version>2.4</commons-io-version>
941941
<commons-cli-version>1.2</commons-cli-version>
942942
<junit-version>4.8.1</junit-version>

0 commit comments

Comments
 (0)