@tsed/schema 6.73.0 → 6.73.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,28 +16,28 @@ export declare class JsonEntityStore extends Entity implements JsonEntityStoreOp
16
16
  * Path used to generate open spec.
17
17
  */
18
18
  path: string;
19
+ constructor(options: JsonEntityStoreOptions);
19
20
  /**
20
21
  * Ref to JsonSchema
21
22
  */
22
23
  protected _schema: JsonSchema;
23
24
  /**
24
- * Ref to JsonOperation when the decorated object is a method.
25
- */
26
- protected _operation: JsonOperation;
27
- /**
28
- * Ref to JsonParameter when the decorated object is a parameter.
25
+ * Return the JsonSchema
29
26
  */
30
- protected _parameter: JsonParameter;
27
+ get schema(): JsonSchema;
31
28
  [key: string]: any;
32
- constructor(options: JsonEntityStoreOptions);
33
29
  /**
34
- * Return the JsonSchema
30
+ * Ref to JsonOperation when the decorated object is a method.
35
31
  */
36
- get schema(): JsonSchema;
32
+ protected _operation: JsonOperation;
37
33
  /**
38
34
  * Return the JsonOperation
39
35
  */
40
36
  get operation(): JsonOperation | undefined;
37
+ /**
38
+ * Ref to JsonParameter when the decorated object is a parameter.
39
+ */
40
+ protected _parameter: JsonParameter;
41
41
  /**
42
42
  * Return the JsonParameter
43
43
  */
@@ -79,7 +79,7 @@ export declare class JsonEntityStore extends Entity implements JsonEntityStoreOp
79
79
  */
80
80
  static from<T extends JsonEntityStore = JsonEntityStore>(...args: any[]): NonNullable<T>;
81
81
  static fromMethod(target: any, propertyKey: string | symbol): JsonEntityStore;
82
- getResponseOptions(contentType?: string): undefined | any;
82
+ getResponseOptions(status: number, contentType?: string): undefined | any;
83
83
  /**
84
84
  * Check precondition between value, required and allowedRequiredValues to know if the entity is required.
85
85
  * @param value
package/lib/index.js CHANGED
@@ -2167,10 +2167,10 @@ class JsonEntityStore extends core.Entity {
2167
2167
  return this.from(target, propertyKey, core.descriptorOf(target, propertyKey));
2168
2168
  }
2169
2169
 
2170
- getResponseOptions(contentType = "application/json") {
2170
+ getResponseOptions(status, contentType = "application/json") {
2171
2171
  var _this$operation, _this$operation$getRe;
2172
2172
 
2173
- const media = (_this$operation = this.operation) == null ? void 0 : (_this$operation$getRe = _this$operation.getResponseOf(this.statusCode)) == null ? void 0 : _this$operation$getRe.getMedia(contentType, false);
2173
+ const media = (_this$operation = this.operation) == null ? void 0 : (_this$operation$getRe = _this$operation.getResponseOf(status)) == null ? void 0 : _this$operation$getRe.getMedia(contentType, false);
2174
2174
 
2175
2175
  if (media && media.has("schema")) {
2176
2176
  const schema = media.get("schema");
@@ -2221,7 +2221,11 @@ class JsonEntityStore extends core.Entity {
2221
2221
  if (core.isCollection(type)) {
2222
2222
  this.collectionType = type;
2223
2223
  } else {
2224
- this._type = type;
2224
+ this._type = type; // issue #1534: Enum metadata stored as plain object instead of String (see: https://github.com/tsedio/tsed/issues/1534)
2225
+
2226
+ if (this._type && core.isPlainObject(this._type)) {
2227
+ this._type = String;
2228
+ }
2225
2229
  }
2226
2230
  }
2227
2231
 
@@ -7315,10 +7319,6 @@ function Name(name) {
7315
7319
  store.parameter.name(name);
7316
7320
  break;
7317
7321
 
7318
- case core.DecoratorTypes.METHOD:
7319
- store.operation.name(name);
7320
- break;
7321
-
7322
7322
  default:
7323
7323
  store.parent.schema.addAlias(args[1], name);
7324
7324
  }