[BUG] Export API schema - running into BOM complications
See original GitHub issueDescribe the bug Attempting to use apiManagementManager.inner().apiExports() .get(apimResourceGroupName, apimServiceName, id, exportFormat);
within SpringBoot
Causes an exception which indicates it fails due to inclusion of a Byte Order Mark (BOM) on Jackson transformation to an ApiExportResultInner object.
Exception or Stack Trace com.fasterxml.jackson.core.JsonParseException: Unexpected character (‘’ (code 65279 / 0xfeff)): expected a valid value (number, String, array, object, ‘true’, ‘false’ or ‘null’) at [Source: (String)‘{‘link’:‘https://apimgmtstbp9kg0aataxe9es.blob.core.windows.net/api-export/Aircraft Configuration.json?sv=2017-04-17&sr=b&sig=YwMImrNL62TK67PxmMUESoNpuo0937R0JKhvsfRRKVI%3D&se=2019-09-23T17:43:54Z&sp=r’}’; line: 1, column: 2]
To Reproduce
Run the code snippets to a valid API in API Manager, with any valid ExportFormat, in my case I used swagger-link
, then will see the exception, instead of the expected returned object.
Code Snippet pom.xml snippet: <dependency> <groupId>com.microsoft.azure</groupId> <artifactId>azure-mgmt-apimanagement</artifactId> <version>1.10.0-beta</version> </dependency>
code snippet: … public ApiExportModel findExportByIdAndFormat(final String id, final String format) { ExportFormat exportFormat = ExportFormat.fromString(format); ApiExportResultInner apiExportResultInner = apiManagementManager.inner().apiExports() .get(apimResourceGroupName, apimServiceName, id, exportFormat); …
controller code: … @RequestMapping(value = ‘/{id}/export/{format}’, method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE ) public ResponseEntity<?> findExportByIdAndFormat(@PathVariable(‘id’) final String id, @PathVariable(‘format’) final String format) { try { return new ResponseEntity<>(apisService.findExportByIdAndFormat(id, format), HttpStatus.OK); } catch (Exception e) { return new ResponseEntity<>(‘Nothing found’, HttpStatus.NOT_FOUND); } } …
calling method with id = ‘aircraft-configuration’ // an API ID that works for other requests format =‘swagger-link’ // (or any ExportFormat)
Expected behavior I expected the ApiExportResultInner object to be returned from the call, but instead see the exception.
Setup (please complete the following information):
- OS: CentOS 7.6.1810 (core)
- IDE : STS4 - 4.4.0.RELEASE
- Version of the Library used: openjdk 64bit 1.8.0_222-b10, azure-mgmt-apimanagement:1.10.0-beta
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (9 by maintainers)
@d2baker we have located the issue and will deploy the fix within the next 2 weeks.
yes, we have resolved the issue. By 10/21/2019 all service in national clouds should also have the fix