Skip to content

Commit

Permalink
add bare-bones documentation on encoding of bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnhoekstra authored and blast-hardcheese committed Oct 11, 2023
1 parent 1d0f72e commit f65961c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
10 changes: 10 additions & 0 deletions modules/microsite/docs/scala/akka-http/dtos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
layout: docs
title: "Encoding - akka-http - scala - guardrail"
---

guardrail will generate data transfer objects with encoders and decoders for entity bodies of requests and responses, as long as they're specified by a `$ref` reference to either in a components section or in a separate file.

Data transfer objects will be represented as case classes, while encoders and decoders depend on the framework used. For dropwizard for example, guardrail will generate jackson encoders and decoders, while for http4s, guardrail will create encoders and decoders for circe.

When your schemas are defined inline however, guardrail will not build typed DTOs for the schemas, but fall back to a generic json representation. One scenario where this can happen is when your api specification is built as a bundle with swagger-cli. Fortunately, guardrail understands the unbundled representation with ref elements to separate files.
1 change: 1 addition & 0 deletions modules/microsite/docs/scala/akka-http/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Table of Contents
1. [Fewer binary dependencies](what-is-guardrail#fewer-binary-dependencies)
1. [Installation](installation)
1. [Sample API specification](sample-api-specification)
1. [Generating Domain Objects](dtos)
1. [Generating a Server](generating-a-server)
1. [Separation of business logic](generating-a-server#separation-of-business-logic)
1. [API structure slip is impossible](generating-a-server#api-structure-slip-is-impossible)
Expand Down
10 changes: 10 additions & 0 deletions modules/microsite/docs/scala/http4s/dtos.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
layout: docs
title: "Encoding - http4s - scala - guardrail"
---

guardrail will generate data transfer objects with encoders and decoders for entity bodies of requests and responses, as long as they're specified by a `$ref` reference to either in a components section or in a separate file.

Data transfer objects will be represented as case classes, while encoders and decoders depend on the framework used. For dropwizard for example, guardrail will generate jackson encoders and decoders, while for http4s, guardrail will create encoders and decoders for circe.

When your schemas are defined inline however, guardrail will not build typed DTOs for the schemas, but fall back to a generic json representation. One scenario where this can happen is when your api specification is built as a bundle with swagger-cli. Fortunately, guardrail understands the unbundled representation with ref elements to separate files.
11 changes: 6 additions & 5 deletions modules/microsite/docs/scala/http4s/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ title: "http4s - scala - guardrail"
Table of Contents
=================

1. [What is guardrail](what-is-guardrail.md)
1. [Single Point of Truth](what-is-guardrail.md#single-point-of-truth)
1. [Unexpected API changes are compiler errors](what-is-guardrail.md#unexpected-api-changes-are-compiler-errors)
1. [Fewer binary dependencies](what-is-guardrail.md#fewer-binary-dependencies)
1. [What is guardrail](what-is-guardrail)
1. [Single Point of Truth](what-is-guardrail#single-point-of-truth)
1. [Unexpected API changes are compiler errors](what-is-guardrail#unexpected-api-changes-are-compiler-errors)
1. [Fewer binary dependencies](what-is-guardrail#fewer-binary-dependencies)
1. [Installation](installation)
1. [Sample API specification](sample-api-specification)
1. [Generating Domain Objects](dtos)
1. [Generating a Server](generating-a-server)
1. [Separation of business logic](generating-a-server#separation-of-business-logic)
1. [API structure slip is impossible](generating-a-server#api-structure-slip-is-impossible)
1. [Generating test-only (real) server mocks for unit tests](generating-a-server#generating-test-only-real-server-mocks-for-unit-tests)
1. [A note about scalatest integration](generating-a-server#a-note-about-scalatest-integration)
1. [Generating clients](generating-clients)
1. [Separation of protocol-concerns from API-level concerns](generating-clients#separation-of-protocol-concerns-from-api-level-concerns)
1. [guardrail Extensions](guardrail-extensions)
1. [guardrail Extensions](guardrail-extensions)

0 comments on commit f65961c

Please sign in to comment.