File tree Expand file tree Collapse file tree
specs/incompatible-properties Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,24 @@ import * as path from "path"
33import { OpenApiDiff } from ".."
44import { fileUrl } from "./fileUrl"
55
6+ test ( "should-allow-different-names" , async ( ) => {
7+ const diff = new OpenApiDiff ( { } )
8+ const file = `src/test/specs/incompatible-properties/different-names.json`
9+ const filePath = fileUrl ( path . resolve ( file ) )
10+
11+ // expected to pass
12+ await diff . compare ( file , file )
13+ } )
14+
15+ test ( "should-allow-duplicate-names" , async ( ) => {
16+ const diff = new OpenApiDiff ( { } )
17+ const file = `src/test/specs/incompatible-properties/duplicate-names.json`
18+ const filePath = fileUrl ( path . resolve ( file ) )
19+
20+ // expected to pass
21+ await diff . compare ( file , file )
22+ } )
23+
624// This test is part of regression test suite for https://github.com/Azure/azure-sdk-tools/issues/5981
725// Given a property with given type and name
826// When another property with the same name but an incompatible type is referenced
Original file line number Diff line number Diff line change 1+ {
2+ "swagger" : " 2.0" ,
3+ "info" : {
4+ "title" : " common-types" ,
5+ "version" : " 1.0"
6+ },
7+ "paths" : {},
8+ "definitions" : {
9+ "Bar" : {
10+ "type" : " object" ,
11+ "properties" : {
12+ "p1" : {
13+ "type" : " string"
14+ }
15+ }
16+ }
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ {
2+ "swagger" : " 2.0" ,
3+ "info" : {
4+ "title" : " different-names" ,
5+ "version" : " 1.0"
6+ },
7+ "paths" : {},
8+ "definitions" : {
9+ "Foo" : {
10+ "type" : " object" ,
11+ "properties" : {
12+ "p1" : {
13+ "type" : " string"
14+ }
15+ },
16+ "allOf" : [
17+ {
18+ "$ref" : " ./common-types.json#/definitions/Bar"
19+ }
20+ ]
21+ },
22+ "Baz" : {
23+ "type" : " object" ,
24+ "properties" : {
25+ "p1" : {
26+ "type" : " object"
27+ }
28+ }
29+ }
30+ }
31+ }
Original file line number Diff line number Diff line change 1+ {
2+ "swagger" : " 2.0" ,
3+ "info" : {
4+ "title" : " duplicate-names" ,
5+ "version" : " 1.0"
6+ },
7+ "paths" : {},
8+ "definitions" : {
9+ "Foo" : {
10+ "type" : " object" ,
11+ "properties" : {
12+ "p1" : {
13+ "type" : " string"
14+ }
15+ },
16+ "allOf" : [
17+ {
18+ "$ref" : " ./common-types.json#/definitions/Bar"
19+ }
20+ ]
21+ },
22+ "Bar" : {
23+ "type" : " object" ,
24+ "properties" : {
25+ "p1" : {
26+ "type" : " object"
27+ }
28+ }
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments