Hello again, I was wondering how the swagger impor...
# azure
h
Hello again, I was wondering how the swagger import should look like. I've written the following but getting unexpected character error. `const api = new azure.apimanagement.Api(
${prefix}-api
, {` `name:
${prefix}-api
,`
resourceGroupName: resourceGroup.name,
apiManagementName: service.name.apply(async (o) => {
if (!pulumi.runtime.isDryRun()) {
await sleep();
}
return o;
}), `displayName:
api-${prefix}
,`
protocols: ["https"],
revision: "1",
path: "weather",
import: {
contentFormat: "swagger-json",
contentValue: "<https://ddm-te-dev-2-as.azurewebsites.net/swagger/v1/swagger.json>"
}
`}, { import:
/subscriptions/${subId}/resourceGroups/${prefix}-rg/providers/Microsoft.ApiManagement/service/${prefix}-ams/apis/${prefix}-api
, customTimeouts: { create: "10m", update: "10m" } });`
t
Try
Copy code
swagger-link-json
instead of
swagger-json
or put the actual JSON into the
contentValue
h
So rewrote it so that I get the json string before with the following code :
let contentValue: any = service.name.apply(async (o) => {
if (!pulumi.runtime.isDryRun()) {
<http://pulumi.log.info|pulumi.log.info>("starta &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
let response = await axios.get("<https://ddm-te-dev-2-as.azurewebsites.net/swagger/v1/swagger.json>");
let contentValue = response.data
contentValue = JSON.stringify(contentValue)
<http://pulumi.log.info|pulumi.log.info>("after get €€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€")
<http://pulumi.log.info|pulumi.log.info>(contentValue)
}
return contentValue;
})
<http://pulumi.log.info|pulumi.log.info>("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
`const api = new azure.apimanagement.Api(
${prefix}-api
, {` `name:
${prefix}-api
,`
resourceGroupName: resourceGroup.name,
apiManagementName: service.name,
`displayName:
api-${prefix}
,`
protocols: ["https"],
revision: "1",
path: "weather",
import: {
contentFormat: "swagger-json",
contentValue: contentValue
}
`}, { import:
/subscriptions/${subId}/resourceGroups/${prefix}-rg/providers/Microsoft.ApiManagement/service/${prefix}-ams/apis/${prefix}-api
, customTimeouts: { create: "10m", update: "10m" } });`
but this didn't work I get the error that it can resolve 51 promises, so I tried hardcoding the json string aswell but then I got the error Parsing error(s): The Swagger version specified is unknown.
So I am at a loss on how to resolve this issue.
t
Hmm… yeah, unfortunately I never did this myself. Are there any examples online of a proven swagger that should work, so that you could try using that one?