counterfact 0.21.1 → 0.21.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # counterfact
2
2
 
3
+ ## 0.21.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 9ca754f: fix another bug where OpenAPI2 puts the produces proprty in the root
8
+
3
9
  ## 0.21.1
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterfact",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "a library for building a fake REST API for testing",
5
5
  "type": "module",
6
6
  "main": "./src/server/counterfact.js",
@@ -101,7 +101,8 @@ export class OperationTypeCoder extends Coder {
101
101
 
102
102
  const responseType = new ResponseTypeCoder(
103
103
  this.requirement.get("responses"),
104
- this.requirement.get("produces")?.data
104
+ this.requirement.get("produces")?.data ??
105
+ this.requirement.specification?.rootRequirement?.get("produces")?.data
105
106
  ).write(script);
106
107
 
107
108
  const proxyType = "(url: string) => { proxyUrl: string }";
@@ -53,15 +53,27 @@ exports[`an OperationTypeCoder generates a complex post operation (OpenAPI 2 wit
53
53
  response: ResponseBuilderFactory<{
54
54
  200: {
55
55
  headers: {};
56
- content: {};
56
+ content: {
57
+ \\"application/json\\": {
58
+ schema: Type;
59
+ };
60
+ };
57
61
  };
58
62
  400: {
59
63
  headers: {};
60
- content: {};
64
+ content: {
65
+ \\"application/json\\": {
66
+ schema: Type;
67
+ };
68
+ };
61
69
  };
62
70
  [statusCode in Exclude<HttpStatusCode, 200 | 400>]: {
63
71
  headers: {};
64
- content: {};
72
+ content: {
73
+ \\"application/json\\": {
74
+ schema: Type;
75
+ };
76
+ };
65
77
  };
66
78
  }>;
67
79
  proxy: (url: string) => { proxyUrl: string };