File tree Expand file tree Collapse file tree 4 files changed +76
-1
lines changed Expand file tree Collapse file tree 4 files changed +76
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import _memoize from "lodash/memoize"
1818import find from "lodash/find"
1919import some from "lodash/some"
2020import eq from "lodash/eq"
21+ import isFunction from "lodash/isFunction"
2122import { memoizedSampleFromSchema , memoizedCreateXMLExample } from "core/plugins/samples/fn"
2223import win from "./window"
2324import cssEscape from "css.escape"
@@ -80,11 +81,14 @@ export function fromJSOrdered(js) {
8081 if ( Array . isArray ( js ) ) {
8182 return Im . Seq ( js ) . map ( fromJSOrdered ) . toList ( )
8283 }
83- if ( js . entries ) {
84+ if ( isFunction ( js . entries ) ) {
8485 // handle multipart/form-data
8586 const objWithHashedKeys = createObjWithHashedKeys ( js )
8687 return Im . OrderedMap ( objWithHashedKeys ) . map ( fromJSOrdered )
8788 }
89+ if ( js . entries && ! isFunction ( js . entries ) ) {
90+ return Im . OrderedMap ( js . entries ) . map ( fromJSOrdered )
91+ }
8892 return Im . OrderedMap ( js ) . map ( fromJSOrdered )
8993}
9094
Original file line number Diff line number Diff line change 1+ swagger : " 2.0"
2+ info :
3+ description : " OAS2 sample with entries as property name"
4+ version : " 0.0.1"
5+ title : " Swagger Sample"
6+ paths :
7+ /pet :
8+ post :
9+ summary : " Add a new pet to the store"
10+ description : " "
11+ parameters :
12+ - in : " body"
13+ name : " body"
14+ schema :
15+ $ref : " #/definitions/Pet"
16+ responses :
17+ " 405 " :
18+ description : " Invalid input"
19+ definitions :
20+ Pet :
21+ type : " object"
22+ properties :
23+ id :
24+ type : " integer"
25+ entries : # <-- evaluate
26+ type : " array"
27+ items :
28+ type : " string"
Original file line number Diff line number Diff line change 1+ openapi : 3.0.2
2+ info :
3+ title : OAS 3.0 sample with entries as property name
4+ version : 0.1.0
5+ paths :
6+ /test/ :
7+ get :
8+ summary : Test
9+ operationId : test_test__get
10+ responses :
11+ ' 200 ' :
12+ description : Successful Response
13+ content :
14+ application/json :
15+ schema :
16+ $ref : ' #/components/schemas/Testmodel'
17+ components :
18+ schemas :
19+ Testmodel :
20+ title : Testmodel
21+ required :
22+ - name
23+ - entries
24+ type : object
25+ properties :
26+ name :
27+ title : Name
28+ type : string
29+ entries :
30+ title : Entries
31+ type : integer
Original file line number Diff line number Diff line change 1+ describe ( "Entries should be valid property name" , ( ) => {
2+ it ( "should render a OAS3.0 definition that uses 'entries' as a property name" , ( ) => {
3+ cy . visit ( "/?url=/documents/bugs/6016-oas3.yaml" )
4+ . get ( "#operations-tag-default" )
5+ . should ( "exist" )
6+ } )
7+ it ( "should render a OAS2.0 definition that uses 'entries' as a property name" , ( ) => {
8+ cy . visit ( "/?url=/documents/bugs/6016-oas2.yaml" )
9+ . get ( "#operations-default-post_pet" )
10+ . should ( "exist" )
11+ } )
12+ } )
You can’t perform that action at this time.
0 commit comments