File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -27,17 +27,26 @@ function RefChoice({
27
27
parameters : Parameters ,
28
28
onChange : ( newParams : Parameters ) => void ,
29
29
} ) {
30
+ const pathArr = ( parameters . $ref || '' ) . split ( '/' ) ;
31
+ const currentValueLabel =
32
+ pathArr . length === 3 &&
33
+ pathArr [ 0 ] === '#' &&
34
+ pathArr [ 1 ] === 'definitions' &&
35
+ ( parameters . definitionData || { } ) [ pathArr [ 2 ] ]
36
+ ? parameters . definitionData [ pathArr [ 2 ] ] . title || parameters . $ref
37
+ : parameters . $ref ;
38
+
30
39
return (
31
40
< div className = 'card-select' >
32
41
< Select
33
42
value = { {
34
43
value : parameters . $ref ,
35
- label : parameters . $ref ,
44
+ label : currentValueLabel ,
36
45
} }
37
46
placeholder = 'Reference'
38
47
options = { Object . keys ( parameters . definitionData || { } ) . map ( ( key ) => ( {
39
48
value : `#/definitions/${ key } ` ,
40
- label : `#/definitions/${ key } ` ,
49
+ label : parameters . definitionData [ key ] . title || `#/definitions/${ key } ` ,
41
50
} ) ) }
42
51
onChange = { ( val : any ) => {
43
52
onChange ( { ...parameters , $ref : val . value } ) ;
You can’t perform that action at this time.
0 commit comments