thelovemsg / ticketing_site

ticketing_site
0 stars 0 forks source link

Query 2) Swagger? HATEOAS? What are they? Pros and cons of Two Things #4

Open thelovemsg opened 2 weeks ago

thelovemsg commented 2 weeks ago

What is Swagger.

Swagger is a set of open-source tools built around the OpenAPI Specification that can help you design, build, document, and consume REST APIs. The major Swagger tools include:

Pros:

  1. Automated Documentation: Automatically generates API documentation from code annotations, making it easier for developers to understand and interact with the API.
  2. Interactive Testing: Provides an interactive UI (Swagger UI) where developers can test API endpoints directly from the documentation.
  3. Standardization: Follows the widely adopted OpenAPI specification, improving collaboration between teams and external developers.
  4. Client SDK Generation: Automatically generates client SDKs in various programming languages, simplifying API consumption by providing ready-to-use libraries.
  5. Ecosystem Support: Strong tool support, including IDE plugins, code generators, and testing tools.

Cons:

  1. Extra Setup and Maintenance: Requires developers to maintain annotations in the codebase, which can be time-consuming.
  2. Static API Design: Focuses on documenting endpoints, which can lead to less flexible API designs if not managed carefully.
  3. Manual Updates: Annotations must be updated manually to reflect changes in API behavior, leading to potential outdated documentation.

What is HATEOAS

HATEOAS (Hypermedia as the Engine of Application State) is a constraint of the REST application architecture. HATEOAS keeps the REST style architecture unique from most other network application architectures.

Pros:

  1. Dynamic API Interaction: Enables clients to dynamically discover actions and resources through hypermedia links, reducing the need for hardcoded URLs.
  2. Decoupling Client and Server: Helps decouple clients and servers by providing links to navigate the API, minimizing the impact of changes on clients.
  3. Evolvability: API can evolve without breaking client functionality as long as the hypermedia format remains intact.
  4. Better RESTful Adherence: Aligns closely with REST principles, making APIs more REST-compliant and adaptable.

Cons:

  1. Increased Complexity: Adds complexity to both API and client-side development due to the need to dynamically follow links.
  2. Lack of Standardization: Unlike Swagger, HATEOAS lacks widely adopted tools for documentation and testing, making collaboration more challenging.
  3. Performance Overhead: Including hypermedia links in every response increases payload size, potentially leading to performance issues.
  4. Underutilization: Many API clients do not fully leverage hypermedia features, making HATEOAS implementation redundant in some cases.

good to read: https://swagger.io/docs/specification/v2_0/what-is-swagger/ https://swagger.io/docs/specification/v3_0/about/

thelovemsg commented 2 weeks ago

HATEOAS의 핵심은 서버가 클라이언트에게 상태에 맞는 링크를 제공해주기 때문에, 프론트엔드에서는 그 링크를 그대로 사용하면 된다는 거!

thelovemsg commented 2 weeks ago

HATEOAS의 핵심은 서버가 클라이언트에게 상태에 맞는 링크를 제공해주기 때문에, 프론트엔드에서는 그 링크를 그대로 사용하면 된다는 거!

그래서 쓸까? 말까? 쓰면 좋기는 한데... 현재 집중해야할 것은 ticking 이 구현이 먼저기에 이것은 나중으로 미뤄도 될 것 같다.