swagger-converter icon indicating copy to clipboard operation
swagger-converter copied to clipboard

[BUG]ref error after convertion

Open shiningstarts opened this issue 2 years ago • 1 comments

ref error after convertion

 "openapi": "3.0.1",
 "components": {
    "schemas": {
      "dnsaccountmdl.TRow": {
        "type": "object",
        "properties": {
          "auth_config": {
            "type": "object",
            "description": "auth config",
            "allOf": [{ "$ref": "#/definitions/dnsaccount.TAuthConfig" }]
          }

should be

"components": {
    "openapi": "3.0.1",
    "schemas": {
      "dnsaccountmdl.TRow": {
        "type": "object",
        "properties": {
          "auth_config": {
            "type": "object",
            "description": "auth config",
            "allOf": [{ "$ref": "#/components/schemas/dnsaccount.TAuthConfig" }]
          }

shiningstarts avatar Dec 26 '22 07:12 shiningstarts

Same error on this file: HotelBooking_v2_Version_2.0_swagger_specification.json

Is there a way to solve this with some configuration?

I use a fix with a regex and sed meanwhile if anyone is interested:

  `if [[ "$OSTYPE" == "darwin"* ]]; then

      # macOS

      echo "Fixing # macOS $SPECS_DIR/$DEST_DIR/$filename"

      sed -i '' 's|"$ref":"#/definitions/|"$ref":"#/components/schemas/|g' "$SPECS_DIR/$DEST_DIR/$filename"

    else

      # Linux

      echo "Fixing # Linux $SPECS_DIR/$DEST_DIR/$filename"

      sed -i 's|"$ref":"#/definitions/|"$ref":"#/components/schemas/|g' "$SPECS_DIR/$DEST_DIR/$filename"
   
  fi`

carlos-evolutive avatar Jun 14 '24 10:06 carlos-evolutive