Skip to content

Issue with [sdk/client]Parsing error text from OData does not contain the details message #1175

Description

@sinbai

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Service Used

APIM

API Versions Used

2022-08-01

Description

Terraform applies the following config to import a swagger-json file with errors.

  • Config:
provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-test"
  location = "eastus"
}

resource "azurerm_api_management" "test" {
  name                = "acctestAM-test"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  publisher_name      = "pub1"
  publisher_email     = "pub1@email.com"

  sku_name = "Consumption_0"
}

resource "azurerm_api_management_api" "test" {
  name                = "acctestapi-test"
  resource_group_name = azurerm_resource_group.test.name
  api_management_name = azurerm_api_management.test.name
  display_name        = "api1"
  path                = "api1"
  protocols           = ["https"]
  revision            = "1"

  import {
    content_value  = file("api_management_api_swagger.json")
    content_format = "swagger-json"
  }
}

[api_management_api_swagger.json](https://github.com/user-attachments/files/19307896/api_management_api_swagger.json)

Actual:
TF has no output detailed error information.

  • TF outputs:

performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: ValidationError: One or more fields contain incorrect values:

  • The error message returned by the API:

{"error":{"code":"ValidationError","message":"One or more fields contain incorrect values:","details":[{"code":"ValidationError","target":"representation","message":"Parsing error(s): After parsing a value an unexpected character was encountered: o. Path 'paths['/inventory'].post.summary', line 83, position 9."}]}}

Expected:
TF output information contains detail message.
performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: ValidationError: One or more fields contain incorrect values:Parsing error(s): After parsing a value an unexpected character was encountered: o. Path 'paths['/inventory'].post.summary', line 83, position 9.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions