Skip to content

Commit 0178d8f

Browse files
committed
[autocomplete] fix parameters keyword map
Also remove extra `resize` method from editor service
1 parent f60a377 commit 0178d8f

File tree

2 files changed

+58
-65
lines changed

2 files changed

+58
-65
lines changed

app/scripts/services/editor.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ SwaggerEditor.service('Editor', function Editor(Autocomplete, ASTManager,
101101
session.setTabSize(2);
102102
}
103103

104-
function resize() {
105-
editor.resize();
106-
}
107-
108104
function ready(fn) {
109105
if (angular.isFunction(fn)) {
110106
onReadyFns.push(fn);
@@ -198,7 +194,6 @@ SwaggerEditor.service('Editor', function Editor(Autocomplete, ASTManager,
198194
}
199195

200196
this.aceLoaded = aceLoaded;
201-
this.resize = resize;
202197
this.ready = ready;
203198
this.annotateYAMLErrors = annotateYAMLErrors;
204199
this.annotateSwaggerError = annotateSwaggerError;

app/scripts/services/keyword-map.js

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
11
'use strict';
22

33
SwaggerEditor.service('KeywordMap', function KeywordMap(defaults) {
4+
5+
/*
6+
* JSON Schema completion map constructor
7+
*
8+
* This is necessary because JSON Schema completion map has recursive
9+
* pointers
10+
*/
11+
function JSONSchema() {
12+
_.extend(this,
13+
{
14+
title: String,
15+
type: String,
16+
format: String,
17+
default: this,
18+
description: String,
19+
enum: [String],
20+
minimum: String,
21+
maximum: String,
22+
exclusiveMinimum: String,
23+
exclusiveMaximum: String,
24+
multipleOf: String,
25+
maxLength: String,
26+
minLength: String,
27+
pattern: String,
28+
not: String,
29+
definitions: {
30+
'.': this
31+
},
32+
33+
// array specific keys
34+
items: [this],
35+
minItems: String,
36+
maxItems: String,
37+
uniqueItems: String,
38+
additionalItems: [this],
39+
40+
// object
41+
maxProperties: String,
42+
minProperties: String,
43+
required: String,
44+
additionalProperties: String,
45+
allOf: [this],
46+
properties: {
47+
48+
// property name
49+
'.': this
50+
}
51+
}
52+
);
53+
}
54+
55+
var jsonSchema = new JSONSchema();
456
var schemes = {
557
http: String,
658
https: String,
@@ -45,7 +97,8 @@ SwaggerEditor.service('KeywordMap', function KeywordMap(defaults) {
4597
description: String,
4698
required: String,
4799
type: String,
48-
format: String
100+
format: String,
101+
schema: jsonSchema
49102
};
50103

51104
var security = {
@@ -79,67 +132,13 @@ SwaggerEditor.service('KeywordMap', function KeywordMap(defaults) {
79132
},
80133
deprecated: Boolean,
81134
security: security,
82-
parameters: {
83-
'.': parameter
84-
},
135+
parameters: [parameter],
85136
responses: {
86137
'.': response
87138
},
88139
tags: [String]
89140
};
90141

91-
/*
92-
* JSON Schema completion map constructor
93-
*
94-
* This is necessary because JSON Schema completion map has recursive
95-
* pointers
96-
*/
97-
function JSONSchema() {
98-
_.extend(this,
99-
{
100-
title: String,
101-
type: String,
102-
format: String,
103-
default: this,
104-
description: String,
105-
enum: [String],
106-
minimum: String,
107-
maximum: String,
108-
exclusiveMinimum: String,
109-
exclusiveMaximum: String,
110-
multipleOf: String,
111-
maxLength: String,
112-
minLength: String,
113-
pattern: String,
114-
not: String,
115-
definitions: {
116-
'.': this
117-
},
118-
119-
// array specific keys
120-
items: [this],
121-
minItems: String,
122-
maxItems: String,
123-
uniqueItems: String,
124-
additionalItems: [this],
125-
126-
// object
127-
maxProperties: String,
128-
minProperties: String,
129-
required: String,
130-
additionalProperties: String,
131-
allOf: [this],
132-
properties: {
133-
134-
// property name
135-
'.': this
136-
}
137-
}
138-
);
139-
}
140-
141-
var jsonSchema = new JSONSchema();
142-
143142
var map = {
144143
swagger: String,
145144
info: {
@@ -166,9 +165,10 @@ SwaggerEditor.service('KeywordMap', function KeywordMap(defaults) {
166165
consumes: [mimeTypes],
167166

168167
paths: {
168+
169169
//path
170170
'.': {
171-
parameters: parameter,
171+
parameters: [parameter],
172172
'.': operation
173173
}
174174
},
@@ -179,9 +179,7 @@ SwaggerEditor.service('KeywordMap', function KeywordMap(defaults) {
179179
'.': jsonSchema
180180
},
181181

182-
parameters: {
183-
'.': parameter
184-
},
182+
parameters: [parameter],
185183
responses: {
186184
'.': response
187185
},

0 commit comments

Comments
 (0)