Skip to content

HATEOAS still problematic #570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
valentinabojan opened this issue Apr 15, 2020 · 0 comments
Closed

HATEOAS still problematic #570

valentinabojan opened this issue Apr 15, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@valentinabojan
Copy link

valentinabojan commented Apr 15, 2020

There was a recent fix for HATEOAS support (#549), but the output is still problematic. The spring resource is outputting "albums", but the documentation is generating "additionalProperties" instead.

This is what we get:

// 20200415153822
// http://localhost:8080/v3/api-docs

{
  "openapi": "3.0.1",
  "info": {
    "title": "OpenAPI definition",
    "version": "v0"
  },
  "servers": [
    {
      "url": "http://localhost:8080",
      "description": "Generated server url"
    }
  ],
  "paths": {
    "/api/albums": {
      "get": {
        "tags": [
          "album-controller"
        ],
        "operationId": "getAllAlbums",
        "responses": {
          "200": {
            "description": "default response",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/PagedModelAlbum"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Album": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "releaseDate": {
            "type": "string"
          }
        }
      },
      "Links": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/Link"
        }
      },
      "PageMetadata": {
        "type": "object",
        "properties": {
          "size": {
            "type": "integer",
            "format": "int64"
          },
          "totalElements": {
            "type": "integer",
            "format": "int64"
          },
          "totalPages": {
            "type": "integer",
            "format": "int64"
          },
          "number": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "PagedModelAlbum": {
        "type": "object",
        "properties": {
          "_embedded": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Album"
              }
            }
          },
          "_links": {
            "$ref": "#/components/schemas/Links"
          },
          "page": {
            "$ref": "#/components/schemas/PageMetadata"
          }
        }
      },
      "Link": {
        "$ref": "#/components/schemas/Link"
      }
    }
  }
}

This is what we expect:

// 20200415153535
// http://localhost:8080/v3/api-docs

{
  "openapi": "3.0.1",
  "info": {
    "title": "OpenAPI definition",
    "version": "v0"
  },
  "servers": [
    {
      "url": "http://localhost:8080",
      "description": "Generated server url"
    }
  ],
  "paths": {
    "/api/albums": {
      "get": {
        "tags": [
          "album-controller"
        ],
        "operationId": "getAllAlbums",
        "responses": {
          "200": {
            "description": "default response",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/PagedModelAlbum"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Album": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "releaseDate": {
            "type": "string"
          }
        }
      },
      "Links": {
        "type": "object",
        "additionalProperties": {
          "$ref": "#/components/schemas/Link"
        }
      },
      "PageMetadata": {
        "type": "object",
        "properties": {
          "size": {
            "type": "integer",
            "format": "int64"
          },
          "totalElements": {
            "type": "integer",
            "format": "int64"
          },
          "totalPages": {
            "type": "integer",
            "format": "int64"
          },
          "number": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "PagedModelAlbum": {
        "type": "object",
        "properties": {
          "_embedded": {
            "type": "object",
            "properties": {
              "albums": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Album"
                }
              }
            }
          },
          "_links": {
            "$ref": "#/components/schemas/Links"
          },
          "page": {
            "$ref": "#/components/schemas/PageMetadata"
          }
        }
      },
      "Link": {
        "$ref": "#/components/schemas/Link"
      }
    }
  }
}
@bnasslahsen bnasslahsen added the bug Something isn't working label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants