autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Base64Url is not an AutoRest supported type

Open pomortaz opened this issue 10 years ago • 5 comments

Key Vault REST API for data-plane has data type of Base64Url encoding e.g. https://msdn.microsoft.com/en-us/library/azure/dn878060.aspx

However, this type is not supported by Swagger. Is it possible to add a Microsoft Azure Extension to allow for supporting Base64Url type? Otherwise, Key Vault data-plane SDK cannot be generated using AutoRest.

pomortaz avatar Mar 05 '16 00:03 pomortaz

It's a bug. Swagger supports base64 formatted string via "byte" format (http://swagger.io/specification)

stankovski avatar Mar 05 '16 01:03 stankovski

Base64Url is very similar to Base64, except that the value encoding for characters 62 and 63 is different as it is explained in https://tools.ietf.org/html/rfc4648#page-7.

Previously, Key Vault data plane SDK, was wrapping the hydra generated codes to enable data type conversion of byte to Base64URL. However, since AutoRest supports Base64, having an additional data type of Base64Url seems possible. This is how Key Vault is currently doing the byte to Base64Url conversion.

pomortaz avatar Mar 07 '16 18:03 pomortaz

Maybe this is best addressed by adopting the convention that if the format is 'byte,' i.e. base64-encoded, and the parameter is a query or path parameter, then it's base64URL instead of standard base64?

NiklasGustafsson avatar Mar 08 '16 20:03 NiklasGustafsson

Is this always going to occur in the url of the method, or can properties in the body include such an encoding?

markcowl avatar Mar 10 '16 18:03 markcowl

Properties of type Base64Url encoding are in the body of the requests.

pomortaz avatar Mar 10 '16 18:03 pomortaz