https://pulumi.com logo
#azure
Title
# azure
b

brave-winter-60074

01/20/2021, 2:45 PM
Should Pulumi be able to import swagger version 3 api’s in a api managment api. We get the following error?
t

tall-librarian-49374

01/20/2021, 2:49 PM
Yes, if the service supports it
b

brave-winter-60074

01/20/2021, 2:50 PM
how do we know whether the service supports it?
if we can import it manually?
t

tall-librarian-49374

01/20/2021, 2:54 PM
yes, for example. and look at the generated arm template after that
I think @wet-noon-14291 was doing something like that?
b

brave-winter-60074

01/20/2021, 2:57 PM
cool thank you
@tall-librarian-49374 seems like we can do it manually, but it fails with pulumi. we opened the source and it seems like it is hardcoded to version 2.0
Copy code
/// <summary>
    /// The OpenAPI 2.0 JSON document is hosted on a publicly accessible internet address.
    /// </summary>
    public static ContentFormat Swagger_link_json { get; } = new ContentFormat("swagger-link-json");
in ContentFormat.cs
t

tall-librarian-49374

01/20/2021, 3:20 PM
This is the enum, right?
Try this one?
Copy code
/// <summary>
        /// The OpenAPI 3.0 JSON document is hosted on a publicly accessible internet address.
        /// </summary>
        public static ContentFormat Openapi_json_link { get; } = new ContentFormat("openapi+json-link");
b

brave-winter-60074

01/20/2021, 3:22 PM
we only tried decompiling but it looks like a enumtype
Copy code
/// <summary>
/// Format of the Content in which the API is getting imported.
/// </summary>
[EnumType]
public readonly struct ContentFormat : IEquatable<ContentFormat>
b

brave-winter-60074

01/20/2021, 3:31 PM
thank you, we now got further. the error was due to ContentFormat.swagger json link and we changed it to openapi instead and now it got created. THANK YOU!
w

wet-noon-14291

01/20/2021, 3:34 PM
I did the exact same mistake @brave-winter-60074. It is actually in the doc if you expand the Open API 3 example: https://www.pulumi.com/docs/reference/pkg/azure-nextgen/apimanagement/api/#apimanagementcreateapiusingoai3import .
b

brave-winter-60074

01/20/2021, 3:35 PM
Thank you!
3 Views