vls-openapi-generator 1.8.0 → 1.8.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.
@@ -138,12 +138,18 @@ const generateOpenAPI = async () => {
138
138
  const developmentURLIndex = existingOpenAPIFile.servers.findIndex((x) => x.url.includes('development'));
139
139
  const fetchedDevelopmentURL = await getStackURL(partnerName, 'development');
140
140
  if (fetchedDevelopmentURL) {
141
- existingOpenAPIFile.servers[developmentURLIndex].url = fetchedDevelopmentURL;
141
+ existingOpenAPIFile.servers[developmentURLIndex].url =
142
+ fetchedDevelopmentURL[fetchedDevelopmentURL.length - 1] === '/'
143
+ ? fetchedDevelopmentURL.slice(0, -1)
144
+ : fetchedDevelopmentURL;
142
145
  }
143
146
  const productionURLIndex = existingOpenAPIFile.servers.findIndex((x) => x.url.includes('production'));
144
147
  const fetchedProductionURL = await getStackURL(partnerName, 'production');
145
148
  if (fetchedProductionURL) {
146
- existingOpenAPIFile.servers[productionURLIndex].url = fetchedProductionURL;
149
+ existingOpenAPIFile.servers[productionURLIndex].url =
150
+ fetchedProductionURL[fetchedProductionURL.length - 1] === '/'
151
+ ? fetchedProductionURL.slice(0, -1)
152
+ : fetchedProductionURL;
147
153
  }
148
154
  }
149
155
  await fs_1.promises.writeFile(OUTPUT_FILE, JSON.stringify(existingOpenAPIFile, undefined, 4));
@@ -153,7 +159,7 @@ exports.generateOpenAPI = generateOpenAPI;
153
159
  async function getStackURL(partnerName, environment) {
154
160
  const cloudFormationClient = new client_cloudformation_1.CloudFormationClient();
155
161
  const describeStacksCommand = new client_cloudformation_1.DescribeStacksCommand({
156
- StackName: `${partnerName}-development`
162
+ StackName: `${partnerName}-${environment}`
157
163
  });
158
164
  const result = await cloudFormationClient.send(describeStacksCommand);
159
165
  if (!result.Stacks) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vls-openapi-generator",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -144,7 +144,10 @@ export const generateOpenAPI = async (): Promise<void> => {
144
144
  const fetchedDevelopmentURL = await getStackURL(partnerName, 'development');
145
145
 
146
146
  if (fetchedDevelopmentURL) {
147
- existingOpenAPIFile.servers[developmentURLIndex].url = fetchedDevelopmentURL;
147
+ existingOpenAPIFile.servers[developmentURLIndex].url =
148
+ fetchedDevelopmentURL[fetchedDevelopmentURL.length - 1] === '/'
149
+ ? fetchedDevelopmentURL.slice(0, -1)
150
+ : fetchedDevelopmentURL;
148
151
  }
149
152
 
150
153
  const productionURLIndex = existingOpenAPIFile.servers.findIndex((x) => x.url.includes('production'));
@@ -152,7 +155,10 @@ export const generateOpenAPI = async (): Promise<void> => {
152
155
  const fetchedProductionURL = await getStackURL(partnerName, 'production');
153
156
 
154
157
  if (fetchedProductionURL) {
155
- existingOpenAPIFile.servers[productionURLIndex].url = fetchedProductionURL;
158
+ existingOpenAPIFile.servers[productionURLIndex].url =
159
+ fetchedProductionURL[fetchedProductionURL.length - 1] === '/'
160
+ ? fetchedProductionURL.slice(0, -1)
161
+ : fetchedProductionURL;
156
162
  }
157
163
  }
158
164
 
@@ -164,7 +170,7 @@ async function getStackURL(partnerName: string, environment: 'development' | 'pr
164
170
  const cloudFormationClient = new CloudFormationClient();
165
171
 
166
172
  const describeStacksCommand = new DescribeStacksCommand({
167
- StackName: `${partnerName}-development`
173
+ StackName: `${partnerName}-${environment}`
168
174
  });
169
175
 
170
176
  const result = await cloudFormationClient.send(describeStacksCommand);