diff --git a/.github/workflows/publish-website.yml b/.github/workflows/publish-website.yml
index 28abb68cbd..09e2ccd26d 100644
--- a/.github/workflows/publish-website.yml
+++ b/.github/workflows/publish-website.yml
@@ -11,23 +11,25 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- - uses: actions/setup-java@v4
+ - uses: olafurpg/setup-scala@v14
with:
- distribution: zulu
- java-version: 14
- - uses: ruby/setup-ruby@v1.162.0
- with:
- bundler-cache: true
- - name: Install microsite deps
- run: |
- bundle install --jobs 4 --retry 3 --system
+ java-version: zulu@1.14
- name: Print versions
run: |
java -version
- gpg --version
- ruby --version
- bundle exec jekyll --version
- name: Update website
env:
MICROSITE_PUBLISH_TOKEN: ${{ secrets.MICROSITE_PUBLISH_TOKEN }}
- run: bundle exec sbt microsite/makeMicrosite microsite/publishMicrosite
+ run: |
+ git clone "https://git:$MICROSITE_PUBLISH_TOKEN@github.com/guardrail-dev/guardrail.git" --branch=gh-pages gh-pages && \
+ pushd gh-pages && \
+ git rm -rf . && \
+ git config user.email "hello@guardrail.dev" && \
+ git config user.name "guardrail website builder" && \
+ popd && \
+ sbt microsite/mdoc && \
+ tar -cC modules/microsite/target/mdoc/ . | tar -vxC gh-pages && \
+ pushd gh-pages && \
+ git add . && \
+ git commit -m "Updating ${{ github.ref_name }}" && \
+ git push
diff --git a/.gitignore b/.gitignore
index 2999e7148f..f36eb9eafc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ vendor/
.bundle/
metals.sbt
.sbtopts
+node_modules/
diff --git a/Gemfile b/Gemfile
deleted file mode 100644
index 5a35f02d50..0000000000
--- a/Gemfile
+++ /dev/null
@@ -1,6 +0,0 @@
-# frozen_string_literal: true
-
-source "https://rubygems.org"
-
-gem 'jekyll', '4.3.2'
-gem 'sass'
diff --git a/Gemfile.lock b/Gemfile.lock
deleted file mode 100644
index acc4295692..0000000000
--- a/Gemfile.lock
+++ /dev/null
@@ -1,80 +0,0 @@
-GEM
- remote: https://rubygems.org/
- specs:
- addressable (2.8.5)
- public_suffix (>= 2.0.2, < 6.0)
- colorator (1.1.0)
- concurrent-ruby (1.2.2)
- em-websocket (0.5.3)
- eventmachine (>= 0.12.9)
- http_parser.rb (~> 0)
- eventmachine (1.2.7)
- ffi (1.16.3)
- forwardable-extended (2.6.0)
- google-protobuf (3.25.0-arm64-darwin)
- google-protobuf (3.25.0-x86_64-linux)
- http_parser.rb (0.8.0)
- i18n (1.14.1)
- concurrent-ruby (~> 1.0)
- jekyll (4.3.2)
- addressable (~> 2.4)
- colorator (~> 1.0)
- em-websocket (~> 0.5)
- i18n (~> 1.0)
- jekyll-sass-converter (>= 2.0, < 4.0)
- jekyll-watch (~> 2.0)
- kramdown (~> 2.3, >= 2.3.1)
- kramdown-parser-gfm (~> 1.0)
- liquid (~> 4.0)
- mercenary (>= 0.3.6, < 0.5)
- pathutil (~> 0.9)
- rouge (>= 3.0, < 5.0)
- safe_yaml (~> 1.0)
- terminal-table (>= 1.8, < 4.0)
- webrick (~> 1.7)
- jekyll-sass-converter (3.0.0)
- sass-embedded (~> 1.54)
- jekyll-watch (2.2.1)
- listen (~> 3.0)
- kramdown (2.4.0)
- rexml
- kramdown-parser-gfm (1.1.0)
- kramdown (~> 2.0)
- liquid (4.0.4)
- listen (3.8.0)
- rb-fsevent (~> 0.10, >= 0.10.3)
- rb-inotify (~> 0.9, >= 0.9.10)
- mercenary (0.4.0)
- pathutil (0.16.2)
- forwardable-extended (~> 2.6)
- public_suffix (5.0.3)
- rb-fsevent (0.11.2)
- rb-inotify (0.10.1)
- ffi (~> 1.0)
- rexml (3.2.6)
- rouge (4.2.0)
- safe_yaml (1.0.5)
- sass (3.7.4)
- sass-listen (~> 4.0.0)
- sass-embedded (1.69.5-arm64-darwin)
- google-protobuf (~> 3.23)
- sass-embedded (1.69.5-x86_64-linux-gnu)
- google-protobuf (~> 3.23)
- sass-listen (4.0.0)
- rb-fsevent (~> 0.9, >= 0.9.4)
- rb-inotify (~> 0.9, >= 0.9.7)
- terminal-table (3.0.2)
- unicode-display_width (>= 1.1.1, < 3)
- unicode-display_width (2.5.0)
- webrick (1.8.1)
-
-PLATFORMS
- arm64-darwin-22
- x86_64-linux
-
-DEPENDENCIES
- jekyll (= 4.3.2)
- sass
-
-BUNDLED WITH
- 2.4.20
diff --git a/build.sbt b/build.sbt
index c66312a5bd..6bf2767aeb 100644
--- a/build.sbt
+++ b/build.sbt
@@ -182,6 +182,7 @@ lazy val scalaDropwizard = modules.scalaDropwizard.project
.customDependsOn("scala-support", scalaSupport)
lazy val microsite = baseModule("microsite", "microsite", file("modules/microsite"))
+ .enablePlugins(MdocPlugin)
.settings(
publish / skip := true,
mdocExtraArguments += "--no-link-hygiene",
diff --git a/modules/microsite/docs/docs/scalajs/index.md b/docs/.nojekyll
similarity index 100%
rename from modules/microsite/docs/docs/scalajs/index.md
rename to docs/.nojekyll
diff --git a/modules/microsite/docs/CNAME b/docs/CNAME
similarity index 100%
rename from modules/microsite/docs/CNAME
rename to docs/CNAME
diff --git a/docs/README.md b/docs/README.md
new file mode 100644
index 0000000000..a2e1bc4510
--- /dev/null
+++ b/docs/README.md
@@ -0,0 +1,27 @@
+Introduction
+===
+
+[![Build Status](https://github.com/guardrail-dev/guardrail/workflows/CI/badge.svg)](https://github.com/guardrail-dev/guardrail/actions?query=workflow%3A%22CI%22) | [![codecov](https://codecov.io/gh/guardrail-dev/guardrail/branch/master/graph/badge.svg?token=ssLYYkVBgv)](https://codecov.io/gh/guardrail-dev/guardrail) | [![Matrix chat](https://img.shields.io/matrix/guardrail:matrix.org.svg?label=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#guardrail:matrix.org) | [![Join the chat at https://gitter.im/guardrail-dev/guardrail](https://badges.gitter.im/guardrail-dev/guardrail.svg)](https://gitter.im/guardrail-dev/guardrail?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | [![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-blue.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)
+
+[`guardrail`](https://github.com/guardrail-dev/guardrail) is a code generation tool, capable of reading from OpenAPI/Swagger specification files and generating high quality source code for a variety of languages and frameworks.
+
+Getting started
+===
+
+The following build tool plugins are available:
+
+- [`sbt-guardrail`](https://github.com/guardrail-dev/sbt-guardrail)
+- [`guardrail-maven-plugin`](https://github.com/guardrail-dev/guardrail-maven-plugin)
+- [`guardrail-gradle-plugin`](https://github.com/guardrail-dev/guardrail-gradle-plugin)
+- as well as a manual CLI runner available via [coursier](cli.md)
+
+New plugins are straightforward, simply call one of the exposed functions from
+[`GuardrailRunner`](https://github.com/guardrail-dev/guardrail/blob/master/modules/core/src/main/scala/dev/guardrail/runner/GuardrailRunner.scala)
+with appropriate arguments in order to get a sequence of generated files.
+
+**NB:** Ensure either you or your build tool deduplicates the file sequence, as
+they are not guaranteed to be unique across multiple runs of the guardrail core.
+
+Additionally, check out the [`guardrail-sample`](https://github.com/topics/guardrail-sample) topic on GitHub for more examples.
+
+**Consulting**: If you need help getting started, getting migrated, or adding features, please contact [hello@guardrail.dev](mailto:hello@guardrail.dev).
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
new file mode 100644
index 0000000000..5d56d3848e
--- /dev/null
+++ b/docs/_sidebar.md
@@ -0,0 +1,6 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+- [Java](java/README.md)
+- [Extensions](extensions.md)
diff --git a/modules/microsite/docs/docs/scala/http4s/what-is-guardrail.md b/docs/about.md
similarity index 58%
rename from modules/microsite/docs/docs/scala/http4s/what-is-guardrail.md
rename to docs/about.md
index 3bd4d53b2d..a2fccaf761 100644
--- a/modules/microsite/docs/docs/scala/http4s/what-is-guardrail.md
+++ b/docs/about.md
@@ -1,12 +1,7 @@
----
-layout: docs
-title: "What is guardrail? - http4s - scala - guardrail"
----
-
What is guardrail?
==================
-guardrail is a code generation tool, capable of reading from OpenAPI/Swagger specification files and generating Scala source code, primarily targeting the akka-http and http4s web frameworks, using circe for JSON encoding/decoding.
+guardrail is a code generation tool, capable of reading from OpenAPI/Swagger specification files and generating source code in different languages with a focus on type safety and ergonomics in each target language.
guardrail has three primary goals:
@@ -21,28 +16,42 @@ Single Point of Truth
By describing the shape of an API statically, there are far fewer variables to worry about. HTTP is a _very_ flexible protocol, with many features. By constraining that protocol to a subset that expresses the interface to our server (or service, or microservice), we drastically reduce the burden of handling the entirety of HTTP to the core terms of our API. Focus on semantics of APIs once the basics (routing, data validation) are figured out.
-A secondary benefit of static specifications lies in tooling. Hand-written routing logic can hide security holes, miss best practices, and obscure intent if written incorrectly. This problem is multipled across as many different languages as are supported inside any given company, manifesting as wasted effort implementing the same feature in different languages, or a bug that only occurs 10 percent of the time due to a buggy golang client.
+A secondary benefit of static specifications lies in tooling. Hand-written routing logic can hide security holes, miss best practices, and obscure intent if written incorrectly. This problem is multipled across as many different languages as are supported inside any given company, manifesting as wasted effort implementing the same feature in different languages, or a bug that only occurs 10 percent of the time due to a buggy hand-written client.
Attempting to derive what the attack surface of a server is from the implementation is often the job of entire teams in large companies, and even that may not be enough. Conversely, with a static specification, those teams can build intelligent traffic analysis tools to detect anomalies or intentionally malicious clients built to inject bad data to find bugs.
Unexpected API changes are compiler errors
------------------------------------------
-Once we have a specification, generating traits (or abstract classes) with unimplemented members gives us another powerful tool: New or changed parameters become compiler errors.
+Once we have a specification, generating traits (or abstract classes) with unimplemented members gives us another powerful tool: New or changed parameters become compiler (or linting) errors.
+
+After constraining our vocabulary to a subset of HTTP that serves our business need, even saying "This parameter is optional" forces us to contend with the appearance of optional parameters in our generated `Handler` methods.
+
+Once specified, turning on "unused" warnings helpfully points out that we've forgotten to reflect this most recent change in our tests. A win on both fronts!
+
+Separation of business logic
+----------------------------
+
+Providing an implementation of a function with a well-defined set of inputs and outputs is natural for any developer. By reducing the scope of the interface a developer writes against, implementations are more clear and concise.
-After constraining our vocabulary to a subset of HTTP that serves our business need, even saying "This parameter is optional" forces us to contend with the sudden appearance of `Option[T]` parameters in our generated `Handler` methods.
+Furthermore, by providing business logic as an implementation of an abstract class, unit tests can test the routing layer and business logic independently, by design.
-Once specified, `-Ywarn-unused` helpfully points out that we've forgotten to reflect this most recent change in our tests. A win on both fronts!
+API structure slip is impossible
+--------------------------------
+
+As parameters are explicitly provided as arguments to functions in `Handler`s, any alteration to parameters constitute a new function interface that must be implemented. As a result, if providing an implementation for an externally managed specification, the compiler informs when a previously written function is no longer sufficient.
+
+By representing different response codes and structures as members of an enumeration of valid choices, it's impossible to return a structure that violates the specification, even for less frequently used responses.
+
+Finally, describing an endpoint in your specification without providing an implementation for it is an error. This prevents reduction of functionality due to refactors, human error, or miscommunication with other teams.
Fewer binary dependencies
----------------------
-Traditionally written and maintained client libraries invariably accumulate cruft. In many cases, this is intended to be helpful: papering over a poorly designed API by providing custom logic, renaming parameters to be more convenient, or including properly configured HTTP clients that express retry and backoff semantics the library author provided based on the business requirements known at the time of writing.
+Bespoke, hand-written and maintained client libraries invariably accumulate cruft. In many cases, this is intended to be helpful: papering over a poorly designed API by providing custom logic, renaming parameters to be more convenient, or including properly configured HTTP clients that express retry and backoff semantics the library author provided based on the business requirements known at the time of writing.
-Altering the shape of an API by providing a thick HTTP client reduces the shared terminology between service maintainers and their consumers, or even between consumers coming from different languages.
+This alters the shape of an API, reducing the shared terminology between service maintainers and their consumers, or even between consumers coming from different languages.
-Additionally, by hardcoding even a well-behaved HTTP client into a client library, now consumers are forced to work around that dependency. This may manifest as learning how to use and configure a brand new HTTP client under time pressure, or writing and maintaining brittle [Application Binary Interface (ABI)](https://en.wikipedia.org/wiki/Application_binary_interface)-compatible adapter layers that attempt to use the configuration already present in the rest of the codebase.
+Additionally, by hardcoding even a well-behaved HTTP client into a client library, now consumers are forced to work around that dependency. In the worst case, this could result in a misconfigured underlying library silently falling back to default parameters, or writing and maintaining brittle [Application Binary Interface (ABI)](https://en.wikipedia.org/wiki/Application_binary_interface)-compatible adapter layers that attempt to use the configuration already present in the rest of the codebase.
Once these bespoke HTTP client configurations are built, both they and their dependencies are now added to the grab bag of dependency versions that must be maintained through the life of any given piece of infrastructure. This presents hidden barriers for upgrading all dependencies, as the possibility of transitive dependency conflicts increase as dependency trees become deeper.
-
-[Next: Installation](installation)
diff --git a/docs/cli.md b/docs/cli.md
new file mode 100644
index 0000000000..c8dc7e18b2
--- /dev/null
+++ b/docs/cli.md
@@ -0,0 +1,3 @@
+## CLI runner
+
+TODO
diff --git a/docs/docs/index.html b/docs/docs/index.html
new file mode 100644
index 0000000000..568fd767a1
--- /dev/null
+++ b/docs/docs/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/dropwizard/generating-a-server.html b/docs/docs/java/dropwizard/generating-a-server.html
new file mode 100644
index 0000000000..2316952a35
--- /dev/null
+++ b/docs/docs/java/dropwizard/generating-a-server.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/dropwizard/generating-clients.html b/docs/docs/java/dropwizard/generating-clients.html
new file mode 100644
index 0000000000..b9d919b3f9
--- /dev/null
+++ b/docs/docs/java/dropwizard/generating-clients.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/dropwizard/index.html b/docs/docs/java/dropwizard/index.html
new file mode 100644
index 0000000000..bebb8dd10b
--- /dev/null
+++ b/docs/docs/java/dropwizard/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/dropwizard/installation.html b/docs/docs/java/dropwizard/installation.html
new file mode 100644
index 0000000000..0c88802e26
--- /dev/null
+++ b/docs/docs/java/dropwizard/installation.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/dropwizard/sample-api-specification.html b/docs/docs/java/dropwizard/sample-api-specification.html
new file mode 100644
index 0000000000..c90f02ec77
--- /dev/null
+++ b/docs/docs/java/dropwizard/sample-api-specification.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/dropwizard/what-is-guardrail.html b/docs/docs/java/dropwizard/what-is-guardrail.html
new file mode 100644
index 0000000000..c0c867ba11
--- /dev/null
+++ b/docs/docs/java/dropwizard/what-is-guardrail.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/index.html b/docs/docs/java/index.html
new file mode 100644
index 0000000000..c2afc991f4
--- /dev/null
+++ b/docs/docs/java/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/java/spring-mvc/index.html b/docs/docs/java/spring-mvc/index.html
new file mode 100644
index 0000000000..bde8dfb994
--- /dev/null
+++ b/docs/docs/java/spring-mvc/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http-jackson/index.html b/docs/docs/scala/akka-http-jackson/index.html
new file mode 100644
index 0000000000..cd9292f4d4
--- /dev/null
+++ b/docs/docs/scala/akka-http-jackson/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/dtos.html b/docs/docs/scala/akka-http/dtos.html
new file mode 100644
index 0000000000..568fd767a1
--- /dev/null
+++ b/docs/docs/scala/akka-http/dtos.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/generating-a-server.html b/docs/docs/scala/akka-http/generating-a-server.html
new file mode 100644
index 0000000000..b344164f83
--- /dev/null
+++ b/docs/docs/scala/akka-http/generating-a-server.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/generating-clients.html b/docs/docs/scala/akka-http/generating-clients.html
new file mode 100644
index 0000000000..bedd7a1808
--- /dev/null
+++ b/docs/docs/scala/akka-http/generating-clients.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/guardrail-extensions.html b/docs/docs/scala/akka-http/guardrail-extensions.html
new file mode 100644
index 0000000000..01bc86aab7
--- /dev/null
+++ b/docs/docs/scala/akka-http/guardrail-extensions.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/index.html b/docs/docs/scala/akka-http/index.html
new file mode 100644
index 0000000000..9b08813c3d
--- /dev/null
+++ b/docs/docs/scala/akka-http/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/installation.html b/docs/docs/scala/akka-http/installation.html
new file mode 100644
index 0000000000..3906f083ec
--- /dev/null
+++ b/docs/docs/scala/akka-http/installation.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/sample-api-specification.html b/docs/docs/scala/akka-http/sample-api-specification.html
new file mode 100644
index 0000000000..c90f02ec77
--- /dev/null
+++ b/docs/docs/scala/akka-http/sample-api-specification.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/akka-http/what-is-guardrail.html b/docs/docs/scala/akka-http/what-is-guardrail.html
new file mode 100644
index 0000000000..c0c867ba11
--- /dev/null
+++ b/docs/docs/scala/akka-http/what-is-guardrail.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/dropwizard/index.html b/docs/docs/scala/dropwizard/index.html
new file mode 100644
index 0000000000..3a2f00dc49
--- /dev/null
+++ b/docs/docs/scala/dropwizard/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/dtos.html b/docs/docs/scala/http4s/dtos.html
new file mode 100644
index 0000000000..568fd767a1
--- /dev/null
+++ b/docs/docs/scala/http4s/dtos.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/generating-a-server.html b/docs/docs/scala/http4s/generating-a-server.html
new file mode 100644
index 0000000000..d108582558
--- /dev/null
+++ b/docs/docs/scala/http4s/generating-a-server.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/generating-clients.html b/docs/docs/scala/http4s/generating-clients.html
new file mode 100644
index 0000000000..b40c26dcf5
--- /dev/null
+++ b/docs/docs/scala/http4s/generating-clients.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/guardrail-extensions.html b/docs/docs/scala/http4s/guardrail-extensions.html
new file mode 100644
index 0000000000..13c89fa987
--- /dev/null
+++ b/docs/docs/scala/http4s/guardrail-extensions.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/index.html b/docs/docs/scala/http4s/index.html
new file mode 100644
index 0000000000..791fd16ac4
--- /dev/null
+++ b/docs/docs/scala/http4s/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/installation.html b/docs/docs/scala/http4s/installation.html
new file mode 100644
index 0000000000..3906f083ec
--- /dev/null
+++ b/docs/docs/scala/http4s/installation.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/sample-api-specification.html b/docs/docs/scala/http4s/sample-api-specification.html
new file mode 100644
index 0000000000..c8f88a8ac1
--- /dev/null
+++ b/docs/docs/scala/http4s/sample-api-specification.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/http4s/what-is-guardrail.html b/docs/docs/scala/http4s/what-is-guardrail.html
new file mode 100644
index 0000000000..c0c867ba11
--- /dev/null
+++ b/docs/docs/scala/http4s/what-is-guardrail.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/docs/scala/index.html b/docs/docs/scala/index.html
new file mode 100644
index 0000000000..75767dcf7d
--- /dev/null
+++ b/docs/docs/scala/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/modules/microsite/docs/docs/scala/akka-http/guardrail-extensions.md b/docs/extensions.md
similarity index 97%
rename from modules/microsite/docs/docs/scala/akka-http/guardrail-extensions.md
rename to docs/extensions.md
index 7fab6fd38f..03a8f25d18 100644
--- a/modules/microsite/docs/docs/scala/akka-http/guardrail-extensions.md
+++ b/docs/extensions.md
@@ -1,8 +1,3 @@
----
-layout: docs
-title: "guardrail extensions - akka-http - scala - guardrail"
----
-
guardrail Extensions
====================
@@ -187,5 +182,3 @@ guardrail has [a number of vendor extensions](https://github.com/guardrail-dev/g
-
-[Prev: Generating clients](generating-clients)
diff --git a/modules/microsite/docs/img/favicon.png b/docs/img/favicon.png
similarity index 100%
rename from modules/microsite/docs/img/favicon.png
rename to docs/img/favicon.png
diff --git a/modules/microsite/docs/img/favicon114x114.png b/docs/img/favicon114x114.png
similarity index 100%
rename from modules/microsite/docs/img/favicon114x114.png
rename to docs/img/favicon114x114.png
diff --git a/modules/microsite/docs/img/favicon120x120.png b/docs/img/favicon120x120.png
similarity index 100%
rename from modules/microsite/docs/img/favicon120x120.png
rename to docs/img/favicon120x120.png
diff --git a/modules/microsite/docs/img/favicon128x128.png b/docs/img/favicon128x128.png
similarity index 100%
rename from modules/microsite/docs/img/favicon128x128.png
rename to docs/img/favicon128x128.png
diff --git a/modules/microsite/docs/img/favicon144x144.png b/docs/img/favicon144x144.png
similarity index 100%
rename from modules/microsite/docs/img/favicon144x144.png
rename to docs/img/favicon144x144.png
diff --git a/modules/microsite/docs/img/favicon150x150.png b/docs/img/favicon150x150.png
similarity index 100%
rename from modules/microsite/docs/img/favicon150x150.png
rename to docs/img/favicon150x150.png
diff --git a/modules/microsite/docs/img/favicon152x152.png b/docs/img/favicon152x152.png
similarity index 100%
rename from modules/microsite/docs/img/favicon152x152.png
rename to docs/img/favicon152x152.png
diff --git a/modules/microsite/docs/img/favicon16x16.png b/docs/img/favicon16x16.png
similarity index 100%
rename from modules/microsite/docs/img/favicon16x16.png
rename to docs/img/favicon16x16.png
diff --git a/modules/microsite/docs/img/favicon196x196.png b/docs/img/favicon196x196.png
similarity index 100%
rename from modules/microsite/docs/img/favicon196x196.png
rename to docs/img/favicon196x196.png
diff --git a/modules/microsite/docs/img/favicon24x24.png b/docs/img/favicon24x24.png
similarity index 100%
rename from modules/microsite/docs/img/favicon24x24.png
rename to docs/img/favicon24x24.png
diff --git a/modules/microsite/docs/img/favicon310x150.png b/docs/img/favicon310x150.png
similarity index 100%
rename from modules/microsite/docs/img/favicon310x150.png
rename to docs/img/favicon310x150.png
diff --git a/modules/microsite/docs/img/favicon310x310.png b/docs/img/favicon310x310.png
similarity index 100%
rename from modules/microsite/docs/img/favicon310x310.png
rename to docs/img/favicon310x310.png
diff --git a/modules/microsite/docs/img/favicon32x32.png b/docs/img/favicon32x32.png
similarity index 100%
rename from modules/microsite/docs/img/favicon32x32.png
rename to docs/img/favicon32x32.png
diff --git a/modules/microsite/docs/img/favicon48x48.png b/docs/img/favicon48x48.png
similarity index 100%
rename from modules/microsite/docs/img/favicon48x48.png
rename to docs/img/favicon48x48.png
diff --git a/modules/microsite/docs/img/favicon57x57.png b/docs/img/favicon57x57.png
similarity index 100%
rename from modules/microsite/docs/img/favicon57x57.png
rename to docs/img/favicon57x57.png
diff --git a/modules/microsite/docs/img/favicon60x60.png b/docs/img/favicon60x60.png
similarity index 100%
rename from modules/microsite/docs/img/favicon60x60.png
rename to docs/img/favicon60x60.png
diff --git a/modules/microsite/docs/img/favicon64x64.png b/docs/img/favicon64x64.png
similarity index 100%
rename from modules/microsite/docs/img/favicon64x64.png
rename to docs/img/favicon64x64.png
diff --git a/modules/microsite/docs/img/favicon70x70.png b/docs/img/favicon70x70.png
similarity index 100%
rename from modules/microsite/docs/img/favicon70x70.png
rename to docs/img/favicon70x70.png
diff --git a/modules/microsite/docs/img/favicon72x72.png b/docs/img/favicon72x72.png
similarity index 100%
rename from modules/microsite/docs/img/favicon72x72.png
rename to docs/img/favicon72x72.png
diff --git a/modules/microsite/docs/img/favicon76x76.png b/docs/img/favicon76x76.png
similarity index 100%
rename from modules/microsite/docs/img/favicon76x76.png
rename to docs/img/favicon76x76.png
diff --git a/modules/microsite/docs/img/favicon96x96.png b/docs/img/favicon96x96.png
similarity index 100%
rename from modules/microsite/docs/img/favicon96x96.png
rename to docs/img/favicon96x96.png
diff --git a/modules/microsite/docs/img/first_icon.png b/docs/img/first_icon.png
similarity index 100%
rename from modules/microsite/docs/img/first_icon.png
rename to docs/img/first_icon.png
diff --git a/modules/microsite/docs/img/first_icon2x.png b/docs/img/first_icon2x.png
similarity index 100%
rename from modules/microsite/docs/img/first_icon2x.png
rename to docs/img/first_icon2x.png
diff --git a/modules/microsite/docs/img/first_icon_raw.png b/docs/img/first_icon_raw.png
similarity index 100%
rename from modules/microsite/docs/img/first_icon_raw.png
rename to docs/img/first_icon_raw.png
diff --git a/modules/microsite/docs/img/light_navbar_brand.png b/docs/img/light_navbar_brand.png
similarity index 100%
rename from modules/microsite/docs/img/light_navbar_brand.png
rename to docs/img/light_navbar_brand.png
diff --git a/modules/microsite/docs/img/light_navbar_brand2x.png b/docs/img/light_navbar_brand2x.png
similarity index 100%
rename from modules/microsite/docs/img/light_navbar_brand2x.png
rename to docs/img/light_navbar_brand2x.png
diff --git a/modules/microsite/docs/img/navbar_brand.png b/docs/img/navbar_brand.png
similarity index 100%
rename from modules/microsite/docs/img/navbar_brand.png
rename to docs/img/navbar_brand.png
diff --git a/modules/microsite/docs/img/navbar_brand2x.png b/docs/img/navbar_brand2x.png
similarity index 100%
rename from modules/microsite/docs/img/navbar_brand2x.png
rename to docs/img/navbar_brand2x.png
diff --git a/modules/microsite/docs/img/second_icon.png b/docs/img/second_icon.png
similarity index 100%
rename from modules/microsite/docs/img/second_icon.png
rename to docs/img/second_icon.png
diff --git a/modules/microsite/docs/img/second_icon2x.png b/docs/img/second_icon2x.png
similarity index 100%
rename from modules/microsite/docs/img/second_icon2x.png
rename to docs/img/second_icon2x.png
diff --git a/modules/microsite/docs/img/second_icon_raw.png b/docs/img/second_icon_raw.png
similarity index 100%
rename from modules/microsite/docs/img/second_icon_raw.png
rename to docs/img/second_icon_raw.png
diff --git a/modules/microsite/docs/img/sidebar_brand.png b/docs/img/sidebar_brand.png
similarity index 100%
rename from modules/microsite/docs/img/sidebar_brand.png
rename to docs/img/sidebar_brand.png
diff --git a/modules/microsite/docs/img/sidebar_brand2x.png b/docs/img/sidebar_brand2x.png
similarity index 100%
rename from modules/microsite/docs/img/sidebar_brand2x.png
rename to docs/img/sidebar_brand2x.png
diff --git a/docs/index.html b/docs/index.html
new file mode 100644
index 0000000000..6a94e1f842
--- /dev/null
+++ b/docs/index.html
@@ -0,0 +1,30 @@
+
+
+
+
+ guardrail
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/java/README.md b/docs/java/README.md
new file mode 100644
index 0000000000..7ec7a48c89
--- /dev/null
+++ b/docs/java/README.md
@@ -0,0 +1,103 @@
+Installation
+---
+
+guardrail is available as a modular core, with [Maven](https://github.com/guardrail-dev/guardrail-maven-plugin) and [Gradle](https://github.com/guardrail-dev/guardrail-gradle-plugin) integration. The core can also be run as a stand-alone [CLI](cli.md) application, with full support for all features.
+
+| module | version | depends on |
+|-----|-----|-----|
+| guardrail-core | [![guardrail-core](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-core_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-core_2.12) | |
+| guardrail-java-support | [![guardrail-java-support](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-java-support_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-java-support_2.12) | core |
+| guardrail-java-async-http | [![guardrail-java-async-http](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-java-async-http_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-java-async-http_2.12) | java-support |
+| guardrail-java-dropwizard | [![guardrail-java-dropwizard](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-java-dropwizard_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-java-dropwizard_2.12) | java-support, java-async-http |
+| guardrail-java-spring-mvc | [![guardrail-java-spring-mvc](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-java-spring-mvc_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-java-spring-mvc_2.12) | java-support |
+| guardrail-cli | [![guardrail-cli](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-cli_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-cli_2.12) | guardrail-core |
+
+### Example Maven configuration
+
+Latest [`guardrail-maven-plugin`](https://github.com/guardrail-dev/guardrail-maven-plugin) version [![guardrail-maven-plugin](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-maven-plugin/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-maven-plugin) ([Other releases](https://github.com/guardrail-dev/guardrail-maven-plugin/releases))
+
+guardrail for Dropwizard is generally set up using the maven plugin. This will generate your server or client at build time.
+The following is an example invocation in a `pom.xml` file:
+
+```xml
+
+
+
+ dev.guardrail
+ guardrail-maven-plugin_2.12
+
+
+
+ generate-app-server
+
+ generate-sources
+
+
+ java
+ dropwizard
+ server
+ server-spec.yaml
+ example.generated
+
+
+
+
+ (...)
+
+
+```
+
+For JDK9+ you also need to add [`javax.annotation:javax.annotation-api`](https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/) dependency:
+
+```xml
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+```
+
+## Vavr Support
+
+In addition, the Java generation backend supports use of either standard
+Java collections types (such as `java.util.Optional` and
+`java.util.Map`), or [Vavr](https://vavr.io/) collections types (such as
+`io.vavr.control.Option` and `io.vavr.collection.Vector`). Vavr's
+collection types are more internally consistent and attempt to provide
+an interface familiar to functional programmers. Scala developers will
+find their APIs especially familiar.
+
+To make use of the Vavr generation, you need to instead use guardrail's
+module system. Instead of specifying a `framework`, instead specify a
+series of `module`s that describe the framework, protocol, and
+collections library generators to use.
+
+For example, to use Vavr with Dropwizard, the following
+`` can be used:
+
+```xml
+
+ java-vavr
+ jackson
+ dropwizard
+
+```
+
+Currently, Vavr is only supported with the `dropwizard` framework.
+
+Frameworks
+---
+
+Configuration for the following libraries is available:
+
+- [Dropwizard](java/dropwizard/README.md)
+- [spring-mvc](java/spring-mvc/README.md)
+
+Sample repositories
+---
+
+There's a GitHub topic [here](https://github.com/topics/guardrail-sample), but a selection of those have been reproduced here:
+
+- [guardrail-dev/guardrail-sample-gradle-springmvc](https://github.com/guardrail-dev/guardrail-sample-gradle-springmvc)
diff --git a/docs/java/_sidebar.md b/docs/java/_sidebar.md
new file mode 100644
index 0000000000..f1f7f006a3
--- /dev/null
+++ b/docs/java/_sidebar.md
@@ -0,0 +1,8 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+- [Java](java/README.md)
+ - [dropwizard](java/dropwizard/README.md)
+ - [spring-mvc](java/spring-mvc/README.md)
+- [Extensions](extensions.md)
diff --git a/modules/microsite/docs/docs/java/dropwizard/generating-a-server.md b/docs/java/dropwizard/README.md
similarity index 69%
rename from modules/microsite/docs/docs/java/dropwizard/generating-a-server.md
rename to docs/java/dropwizard/README.md
index decfb16a0c..a7abb9dff5 100644
--- a/modules/microsite/docs/docs/java/dropwizard/generating-a-server.md
+++ b/docs/java/dropwizard/README.md
@@ -1,15 +1,8 @@
----
-layout: docs
-title: "Generating a Server - java - dropwizard - guardrail"
----
+## Generating a Server
-Generating a Server
-===================
+## Setup
-Setup
------
-
-As we saw in [Installation](installation), guardrail is run as part of maven. It hooks into the `generate-sources` goal. This means our generated server and client is always up-to-date with the specfificaion file.
+As we saw in [Installation](java/README.md#Installation), guardrail is run as part of maven. It hooks into the `generate-sources` goal. This means our generated server and client is always up-to-date with the specfificaion file.
Lets take another look at the maven config for guardrail:
@@ -39,8 +32,7 @@ Lets take another look at the maven config for guardrail:
Once configured, you can manually invoke guardrail with `mvn generate-sources`.
-Server Handlers, Resources
---------------------------
+### Server Handlers, Resources
guardrail-generated servers come in two parts: a `Resource` and a `Handler`. The `Resource` contains all the JAX-RS routing logic, accepting a `Handler` as a definion of the logic to perform for the routes. The `Handler` is generated as an interface. You will write the implementation of the `Handler` and pass it to the `Resource` in the bootstrapping of the Dropwizard service.
@@ -89,21 +81,47 @@ This illistrates that while guardrail has helped us with much of the setup relat
(See it in action: [guardrail-dev/guardrail-sample-maven-dropwizard](https://github.com/guardrail-dev/guardrail-sample-maven-dropwizard))
-Separation of business logic
-----------------------------
-
-Providing an implementating of a function with a well-defined set of inputs and outputs is natural for any developer. By reducing the scope of the interface a developer writes against, implementations are more clear and concise.
-
-Furthermore, by providing business logic as an implementation of an abstract class, unit tests can test the routing layer and business logic independently, by design.
+## Generating clients
-API structure slip is impossible
---------------------------------
-
-As parameters are explicitly provided as arguments to functions in `Handler`s, any alteration to parameters constitute a new function interface that must be implemented. As a result, if providing an implementation for an externally managed specification, the compiler informs when a previously written function is no longer sufficient.
+To generate client code with maven please include following plugin to your pom.xml:
+```xml
+
+
+
+ dev.guardrail
+ guardrail-maven-plugin_2.12
+ 0.62.0
+
+
+ generate-app-server
+
+ generate-sources
+
+
+ java
+ dropwizard
+ client
+ spec.oas3.yaml
+ demowizard.client.generated
+
+
+
+
+ (...)
+
+
+```
-By representing different response codes and structures as members of a sealed trait, it's impossible to return a structure that violates the specification, even for less frequently used response codes.
+For JDK9+ you also need to add [`javax.annotation:javax.annotation-api`](https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/) dependency:
-Finally, describing an endpoint in your specification without providing an implementation for it is a compiler error. This prevents reduction of functionality due to refactors, human error, or miscommunication with other teams.
+```xml
+
+
+ javax.annotation
+ javax.annotation-api
+ 1.3.2
+
+
+```
-[Prev: Sample API specification](sample-api-specification)
-[Next: Generating clients](generating-clients)
+(See it in action: [guardrail-dev/guardrail-sample-maven-dropwizard](https://github.com/guardrail-dev/guardrail-sample-maven-dropwizard))
diff --git a/docs/java/dropwizard/_sidebar.md b/docs/java/dropwizard/_sidebar.md
new file mode 100644
index 0000000000..8665c3a749
--- /dev/null
+++ b/docs/java/dropwizard/_sidebar.md
@@ -0,0 +1,7 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+- [Java](java/README.md)
+ - [dropwizard](java/dropwizard/README.md)
+- [Extensions](extensions.md)
diff --git a/docs/java/dropwizard/generating-a-server.html b/docs/java/dropwizard/generating-a-server.html
new file mode 100644
index 0000000000..2316952a35
--- /dev/null
+++ b/docs/java/dropwizard/generating-a-server.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/java/dropwizard/generating-clients.html b/docs/java/dropwizard/generating-clients.html
new file mode 100644
index 0000000000..b9d919b3f9
--- /dev/null
+++ b/docs/java/dropwizard/generating-clients.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/java/dropwizard/index.html b/docs/java/dropwizard/index.html
new file mode 100644
index 0000000000..bebb8dd10b
--- /dev/null
+++ b/docs/java/dropwizard/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/java/dropwizard/installation.html b/docs/java/dropwizard/installation.html
new file mode 100644
index 0000000000..0c88802e26
--- /dev/null
+++ b/docs/java/dropwizard/installation.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/java/dropwizard/sample-api-specification.html b/docs/java/dropwizard/sample-api-specification.html
new file mode 100644
index 0000000000..c90f02ec77
--- /dev/null
+++ b/docs/java/dropwizard/sample-api-specification.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/java/dropwizard/what-is-guardrail.html b/docs/java/dropwizard/what-is-guardrail.html
new file mode 100644
index 0000000000..c0c867ba11
--- /dev/null
+++ b/docs/java/dropwizard/what-is-guardrail.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/java/index.html b/docs/java/index.html
new file mode 100644
index 0000000000..c2afc991f4
--- /dev/null
+++ b/docs/java/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/modules/microsite/docs/docs/java/spring-mvc/index.md b/docs/java/spring-mvc/README.md
similarity index 83%
rename from modules/microsite/docs/docs/java/spring-mvc/index.md
rename to docs/java/spring-mvc/README.md
index 498042600f..8029a3417e 100644
--- a/modules/microsite/docs/docs/java/spring-mvc/index.md
+++ b/docs/java/spring-mvc/README.md
@@ -1,7 +1,4 @@
----
-layout: docs
-title: "Spring MVC - java - guardrail"
----
+## Spring MVC
These docs are under construction!
diff --git a/docs/java/spring-mvc/_sidebar.md b/docs/java/spring-mvc/_sidebar.md
new file mode 100644
index 0000000000..0e3e515418
--- /dev/null
+++ b/docs/java/spring-mvc/_sidebar.md
@@ -0,0 +1,7 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+- [Java](java/README.md)
+ - [spring-mvc](java/spring-mvc/README.md)
+- [Extensions](extensions.md)
diff --git a/docs/java/spring-mvc/index.html b/docs/java/spring-mvc/index.html
new file mode 100644
index 0000000000..bde8dfb994
--- /dev/null
+++ b/docs/java/spring-mvc/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/modules/microsite/docs/docs/scala/akka-http/sample-api-specification.md b/docs/sample-spec.md
similarity index 96%
rename from modules/microsite/docs/docs/scala/akka-http/sample-api-specification.md
rename to docs/sample-spec.md
index 1d741d643f..cd954b3c3c 100644
--- a/modules/microsite/docs/docs/scala/akka-http/sample-api-specification.md
+++ b/docs/sample-spec.md
@@ -1,12 +1,7 @@
----
-layout: docs
-title: "Sample API Specification - akka-http - scala - guardrail"
----
-
Sample API specification
========================
-The following is a complete, annotated OpenAPI specification file: (guardrail extensions are documented in [guardrail Extensions](#guardrail-extensions))
+The following is a complete, annotated OpenAPI specification file: (guardrail extensions are documented in [guardrail Extensions](extensions.md))
```yaml
swagger: "2.0" # Which version of the OpenAPI/Swagger specification we are following
@@ -126,6 +121,3 @@ definitions: # All non-primitive structures are d
line3:
type: string
```
-
-[Prev: Installation](installation)
-[Next: Generating a Server](generating-a-server)
diff --git a/docs/scala/README.md b/docs/scala/README.md
new file mode 100644
index 0000000000..1b43c3c3f7
--- /dev/null
+++ b/docs/scala/README.md
@@ -0,0 +1,80 @@
+Scala
+===
+
+Installation
+---
+
+guardrail is available as a modular core, with both [sbt](https://github.com/guardrail-dev/sbt-guardrail) and [Maven](https://github.com/guardrail-dev/guardrail-maven-plugin) integration. The core can also be run as a stand-alone [CLI](cli.md) application, with full support for all features.
+
+| module | version | depends on |
+|-----|-----|-----|
+| guardrail-scala-support | [![guardrail-scala-support](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-scala-support_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-scala-support_2.12) | core |
+| guardrail-scala-akka-http | [![guardrail-scala-akka-http](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-scala-akka-http_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-scala-akka-http_2.12) | scala-support |
+| guardrail-scala-dropwizard | [![guardrail-scala-dropwizard](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-scala-dropwizard_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-scala-dropwizard_2.12) | scala-support |
+| guardrail-scala-http4s | [![guardrail-scala-http4s](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-scala-http4s_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-scala-http4s_2.12) | scala-support |
+| guardrail-cli | [![guardrail-cli](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/guardrail-cli_2.12/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:guardrail-cli_2.12) | guardrail-core |
+
+### Example SBT configuration
+
+Latest [`sbt-guardrail`](https://github.com/guardrail-dev/sbt-guardrail) version [![sbt-guardrail](https://maven-badges.herokuapp.com/maven-central/dev.guardrail/sbt-guardrail/badge.svg)](https://search.maven.org/search?q=g:dev.guardrail%20a:sbt-guardrail) ([Other releases](https://github.com/guardrail-dev/sbt-guardrail/releases))
+
+Put the following in `project/guardrail.sbt`:
+
+```scala
+addSbtPlugin("dev.guardrail" % "sbt-guardrail" % "")
+libraryDependencies += "dev.guardrail" %% "guardrail-scala-http4s" % ""
+```
+
+... as well as the following in `build.sbt`
+```scala
+guardrailTasks in Compile := List(
+ ScalaClient(file("github.yaml"), pkg="com.example.clients.github", framework="http4s"),
+)
+```
+
+More configuration options available [here](https://github.com/guardrail-dev/sbt-guardrail).
+
+
+If compiling with Scala < 2.13.x... you'll need to enable `-Ypartial-unification`:
+
+```scala
+scalacOptions += "-Ypartial-unification"
+```
+
+
+
+If compiling with Scala < 2.12.x... you'll additionally need the `-Xexperimental` flag:
+
+```scala
+scalacOptions += "-Xexperimental"
+```
+
+
+Frameworks
+---
+
+Configuration for the following libraries is available:
+
+- [Akka-Http](scala/akka-http/README.md)
+- [Http4s](scala/http4s/README.md)
+- [Dropwizard](scala/dropwizard/README.md)
+
+Sample repositories
+---
+
+There's a GitHub topic [here](https://github.com/topics/guardrail-sample), but a selection of those have been reproduced here:
+
+- [guardrail-dev/guardrail-sample-sbt-akkahttp](https://github.com/guardrail-dev/guardrail-sample-sbt-akkahttp)
+- [guardrail-dev/guardrail-sample-sbt-http4s](https://github.com/guardrail-dev/guardrail-sample-sbt-http4s)
+- [guardrail-dev/guardrail-sample-sbt-http4s-zio](https://github.com/guardrail-dev/guardrail-sample-sbt-http4s-zio)
+
+
+TODO: Figure out what to do with this
+Additionally, you will need to manually include dependencies in your project for the following packages:
+- `http4s`, dsl, server, and client dependencies
+- `http4s-circe` for JSON decoding and encoding support
+- `circe-generic` for JSON decoding and encoding support
+- `cats-effect` for http4s integration
+- `cats-core` for http4s integration
+
+Versions of these libraries should be picked by checking out the [Compatibility Matrix](https://github.com/guardrail-dev/guardrail/blob/master/COMPATIBILITY.md).
diff --git a/docs/scala/_sidebar.md b/docs/scala/_sidebar.md
new file mode 100644
index 0000000000..4a1e2191ce
--- /dev/null
+++ b/docs/scala/_sidebar.md
@@ -0,0 +1,9 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+ - [akka-http](scala/akka-http/README.md)
+ - [http4s](scala/http4s/README.md)
+ - [pekko-http](scala/pekko-http/README.md)
+- [Java](java/README.md)
+- [Extensions](extensions.md)
diff --git a/docs/scala/akka-http-jackson/index.html b/docs/scala/akka-http-jackson/index.html
new file mode 100644
index 0000000000..78273a3bff
--- /dev/null
+++ b/docs/scala/akka-http-jackson/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/modules/microsite/docs/docs/scala/akka-http/generating-a-server.md b/docs/scala/akka-http/README.md
similarity index 71%
rename from modules/microsite/docs/docs/scala/akka-http/generating-a-server.md
rename to docs/scala/akka-http/README.md
index 92a3d4a488..f9c7ffd871 100644
--- a/modules/microsite/docs/docs/scala/akka-http/generating-a-server.md
+++ b/docs/scala/akka-http/README.md
@@ -1,10 +1,6 @@
----
-layout: docs
-title: "Generating a Server - akka-http - scala - guardrail"
----
+# Akka-Http
-Generating a Server
-===================
+## Generating a Server
guardrail-generated servers come in two parts: a `Resource` and a `Handler`. The `Resource` contains all the routing logic, accepting a `Handler` as an argument to the `route` function in order to provide an HTTP service in whichever supported HTTP framework you're hosting your service in.
@@ -26,24 +22,7 @@ As all parameters are provided as arguments to the function stubs in the trait,
(See it in action: [guardrail-dev/guardrail-sample-sbt-akkahttp](https://github.com/guardrail-dev/guardrail-sample-sbt-akkahttp))
-Separation of business logic
-----------------------------
-
-Providing an implementation of a function with a well-defined set of inputs and outputs is natural for any developer. By reducing the scope of the interface a developer writes against, implementations are more clear and concise.
-
-Furthermore, by providing business logic as an implementation of an abstract class, unit tests can test the routing layer and business logic independently, by design.
-
-API structure slip is impossible
---------------------------------
-
-As parameters are explicitly provided as arguments to functions in `Handler`s, any alteration to parameters constitute a new function interface that must be implemented. As a result, if providing an implementation for an externally managed specification, the compiler informs when a previously written function is no longer sufficient.
-
-By representing different response codes and structures as members of a sealed trait, it's impossible to return a structure that violates the specification, even for less frequently used response codes.
-
-Finally, describing an endpoint in your specification without providing an implementation for it is a compiler error. This prevents reduction of functionality due to refactors, human error, or miscommunication with other teams.
-
-Extracting custom data from a request
--------------------------------------
+### Extracting custom data from a request
In some cases, you may wish to extract data from a request and inject it into your handler, without specifying the extracted data in the OpenAPI definition. Common use cases include integrating with existing `Directive`s, accessing underlying data provided by akka-http but without a direct analog in OpenAPI, as well as providing an escape hatch to inject functionality expressed via akka-http's `Directive` directly into the Akka HTTP routes generated by guardrail.
@@ -86,8 +65,7 @@ val userRoutes = UserResource.routes(new UserApi, extractXUserId)
Because `E` is an arbitrary type, you may extract anything, including the full `HttpRequest` itself. Multiple values may be extracted using tuples. If you do not wish to extract anything, perhaps because the `Directive` acts as a gate which `pass`es some requests and `reject`s others, simply provide `String => Directive1[Unit]` and write your handler implementation to extend `Handler[Unit]`.
-Generating test-only (real) server mocks for unit tests
--------------------------------------------------------
+## Generating test-only (real) server mocks for unit tests
Often, we'll also want to have mock HTTP clients for use in unit tests. Mocking requires stringent adherence to the specification, otherwise our mock clients are unrepresentative of the production systems they are intending to mock. The following is an example of a "mock" HTTP Client generated by guardrail; it speaks real HTTP, though doesn't need to bind to a port in order to run. This permits parallelized tests to be run without concern of port contention.
@@ -120,10 +98,7 @@ val binding: ServerBinding =
binding.unbind().futureValue
```
-A note about scalatest integration
-----------------------------------
-
-### akka-http
+### A note about scalatest integration
The default `ExceptionHandler` in akka-http swallows exceptions, so if you intend to `fail()` tests from inside guardrail-generated HTTP Servers, you'll likely want to have the following implicit in scope:
@@ -147,5 +122,54 @@ val user: User = getUserResponse.map(_.fold(user => user)).value.futureValue.rig
`futureValue` will raise the `TestFailedException` with the relevant stack trace.
-[Prev: Sample API specification](sample-api-specification)
-[Next: Generating clients](generating-clients)
+## Generating clients
+
+As we've seen in [Generating a Server](scala/akka-http/README.md#generating-a-server), guardrail-generated servers establish a mapping between our business logic and a cordoned off subset of HTTP. This permits us to focus on our business logic, without getting overloaded with the complexities of managing such a large protocol. The same is true with guardrail generated HTTP Clients: from a consumer's standpoint, HTTP calls should look like regular function calls, accepting domain-specific arguments and producing domain-specific results.
+
+By generating minimal clients that only have enough business knowledge to map domain types to and from HTTP, opportunities for logical errors are effectively removed. While this does not eliminate logical errors entirely, establishing a firm boundary between the underlying protocol and hand-written code drastically reduces the scope of possible bugs.
+
+The following is an example from the [akka-http](https://github.com/akka/akka-http) client generator:
+
+```scala mdoc:passthrough
+import dev.guardrail.docs._
+DocsHelpers.renderScalaSnippet("akka-http", GeneratingClients)(
+ """|// Two constructors are provided, one accepting the `httpClient`,
+ |// `ExecutionContext`, and `Materializer` implicitly, the other accepting
+ |// an explicit `httpClient`, but still accepting the `ExecutionContext` and
+ |// `Materializer` as implicits.
+ """.stripMargin,
+ ""
+)
+```
+
+(See it in action: [guardrail-dev/guardrail-sample-sbt-akkahttp](https://github.com/guardrail-dev/guardrail-sample-sbt-akkahttp))
+
+### Separation of protocol-concerns from API-level concerns
+
+As guardrail clients are built on top of the function type `HttpRequest => Future[HttpResponse]`, client configuration is reduced to function composition. Some ideas:
+
+```scala
+val singleRequestHttpClient = { (req: HttpRequest) =>
+ Http().singleRequest(req)
+}
+
+val retryingHttpClient = { nextClient: (HttpRequest => Future[HttpResponse]) =>
+ req: HttpRequest => nextClient(req).flatMap(resp => if (resp.status.intValue >= 500) nextClient(req) else Future.successful(resp))
+}
+
+val metricsHttpClient = { nextClient: (HttpRequest => Future[HttpResponse]) =>
+ req: HttpRequest => {
+ val resp = nextClient(req)
+ resp.onSuccess { _resp =>
+ trackMetrics(req.uri.path, _resp.status)
+ }
+ resp
+ }
+}
+
+// Track metrics for every request, even retries
+val retryingMetricsClient1: HttpRequest => Future[HttpResponse] = retryingHttpClient(metricsHttpClient(singleRequestHttpClient))
+
+// Only track metrics for requests we didn't have to retry
+val retryingMetricsClient2: HttpRequest => Future[HttpResponse] = metricsHttpClient(retryingHttpClient(singleRequestHttpClient))
+```
diff --git a/docs/scala/akka-http/_sidebar.md b/docs/scala/akka-http/_sidebar.md
new file mode 100644
index 0000000000..f03fec360f
--- /dev/null
+++ b/docs/scala/akka-http/_sidebar.md
@@ -0,0 +1,8 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+ - [akka-http](scala/akka-http/README.md)
+ - [akka-http-jackson](scala/akka-http/jackson.md)
+- [Java](java/README.md)
+- [Extensions](extensions.md)
diff --git a/docs/scala/akka-http/dtos.html b/docs/scala/akka-http/dtos.html
new file mode 100644
index 0000000000..568fd767a1
--- /dev/null
+++ b/docs/scala/akka-http/dtos.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/akka-http/generating-a-server.html b/docs/scala/akka-http/generating-a-server.html
new file mode 100644
index 0000000000..b344164f83
--- /dev/null
+++ b/docs/scala/akka-http/generating-a-server.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/akka-http/generating-clients.html b/docs/scala/akka-http/generating-clients.html
new file mode 100644
index 0000000000..bedd7a1808
--- /dev/null
+++ b/docs/scala/akka-http/generating-clients.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/akka-http/guardrail-extensions.html b/docs/scala/akka-http/guardrail-extensions.html
new file mode 100644
index 0000000000..01bc86aab7
--- /dev/null
+++ b/docs/scala/akka-http/guardrail-extensions.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/akka-http/index.html b/docs/scala/akka-http/index.html
new file mode 100644
index 0000000000..9b08813c3d
--- /dev/null
+++ b/docs/scala/akka-http/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/akka-http/installation.html b/docs/scala/akka-http/installation.html
new file mode 100644
index 0000000000..3906f083ec
--- /dev/null
+++ b/docs/scala/akka-http/installation.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/modules/microsite/docs/docs/scala/akka-http-jackson/index.md b/docs/scala/akka-http/jackson.md
similarity index 80%
rename from modules/microsite/docs/docs/scala/akka-http-jackson/index.md
rename to docs/scala/akka-http/jackson.md
index f0af04d490..38c208204f 100644
--- a/modules/microsite/docs/docs/scala/akka-http-jackson/index.md
+++ b/docs/scala/akka-http/jackson.md
@@ -1,21 +1,18 @@
----
-layout: docs
-title: "akka-http-jackson - scala - guardrail"
----
+## akka-http Jackson
The `akka-http-jackson` framework generates the same server and client
-APIs as the [akka-http](../akka-http) framework, except that Jackson is
+APIs as the [akka-http](scala/akka-http/README.md) framework, except that Jackson is
used for serialization and deserialization (instead of Circe).
Usage-wise, it is very similar to `akka-http`. Extra information
specific to this framework can be found below.
-## guardrail Configuration
+### guardrail Configuration
-You can either specify the `akka-http-jackson` framework, or the
+You can either specify the `akka-http-jackson` framework, or select the
`akka-http` and `jackson` modules.
-## Prerequisites
+### Prerequisites
In addition to the akka-http dependencies, you'll need the following:
@@ -32,7 +29,7 @@ While testing has been done with Jackson 2.11.x, older 2.x versions
should work as well. Hibernate Validator 5.4.x and 6.0.x have been
tested and appear to work.
-## Server and Client Construction
+### Server and Client Construction
When constructing your server routes or client instances, you'll need
implicit `ObjectMapper` (Jackson) and `Validator` (Hibernate) instances
@@ -46,8 +43,7 @@ spec uses date or date-time string formats, you must also register
### `Validator`
-The validator can [be
-constructed](https://docs.jboss.org/hibernate/validator/5.4/reference/en-US/html_single/#section-retrieving-validator-factory-validator)
+The validator can [be constructed](https://docs.jboss.org/hibernate/validator/5.4/reference/en-US/html_single/#section-retrieving-validator-factory-validator)
in whatever manner you desire. Hibernate is recommended, but guardrail
does not currently use any Hibernate-specific annotations; however, it
may do so in the future as more strict validations are implemented.
diff --git a/docs/scala/akka-http/sample-api-specification.html b/docs/scala/akka-http/sample-api-specification.html
new file mode 100644
index 0000000000..c90f02ec77
--- /dev/null
+++ b/docs/scala/akka-http/sample-api-specification.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/akka-http/what-is-guardrail.html b/docs/scala/akka-http/what-is-guardrail.html
new file mode 100644
index 0000000000..c0c867ba11
--- /dev/null
+++ b/docs/scala/akka-http/what-is-guardrail.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/modules/microsite/docs/docs/scala/dropwizard/index.md b/docs/scala/dropwizard/README.md
similarity index 96%
rename from modules/microsite/docs/docs/scala/dropwizard/index.md
rename to docs/scala/dropwizard/README.md
index 10dd8b5d5e..a0bc8d5a0e 100644
--- a/modules/microsite/docs/docs/scala/dropwizard/index.md
+++ b/docs/scala/dropwizard/README.md
@@ -1,7 +1,4 @@
----
-layout: docs
-title: "dropwizard - scala - guardrail"
----
+# Dropwizard
The `dropwizard` framework generates Scala code for Dropwizard, using
Jackson for serialization.
@@ -28,7 +25,7 @@ with Jersey in your application's `run()` method using
### Usage
Server usage follows the same pattern as the Scala
-[akka-http](../akka-http) framework. You must implement a `Handler`
+[akka-http](scala/akka-http/README.md) framework. You must implement a `Handler`
class for each resource. Each handler method takes a `respond`
parameter, which allows you to easily construct response instances, plus
all parameters specified for the method's underlying operation. The
diff --git a/docs/scala/dropwizard/index.html b/docs/scala/dropwizard/index.html
new file mode 100644
index 0000000000..3a2f00dc49
--- /dev/null
+++ b/docs/scala/dropwizard/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/README.md b/docs/scala/http4s/README.md
new file mode 100644
index 0000000000..1c4f9c6f1d
--- /dev/null
+++ b/docs/scala/http4s/README.md
@@ -0,0 +1,71 @@
+## Generating a Server
+
+guardrail-generated servers come in two parts: a `Resource` and a `Handler`. The `Resource` contains all the routing logic, accepting a `Handler` as an argument to the `route` function in order to provide an HTTP service in whichever supported HTTP framework you're hosting your service in.
+
+The following is an example from the [http4s](https://github.com/http4s/http4s) server generator:
+
+```scala mdoc:passthrough
+import dev.guardrail.docs._
+DocsHelpers.renderScalaSnippet("http4s", GeneratingAServer)("""
+ |// The `Handler` trait is fully abstracted from the underlying http framework. As a result, with the exception of some
+ |// structural alterations (`F[_]` instead of `Future[_]` as the return type) the same handlers can be used with
+ |// different `Resource` implementations from different framework generators. This permits greater compatibility between
+ |// different frameworks without changing your business logic.
+ """.stripMargin,
+ ""
+)
+```
+
+As all parameters are provided as arguments to the function stubs in the trait, there's no concern of forgetting to extract a query string parameter or introducing a typo in a form parameter name.
+
+The routes and resources generated by guardrail can be hooked up into your HTTP4s server like so:
+
+```scala
+import org.http4s.ember.server.EmberServerBuilder
+
+class UserImpl extends UserHandler[IO] { /* Your code here */ }
+val userHandler: UserHandler[IO] = new UserImpl
+val usersService = new UsersResource[IO]().routes(userHandler)
+val httpApp = usersService.orNotFound
+
+// Same basic server setup as in the http4s quickstart
+EmberServerBuilder.default[IO]
+ .withHttpApp(httpApp)
+ .build
+ .use(_ => IO.never)
+ .as(ExitCode.Success)
+```
+
+(See it in action: [guardrail-dev/guardrail-sample-http4s](https://github.com/guardrail-dev/guardrail-sample-http4s), [guardrail-dev/guardrail-sample-sbt-http4s-zio](https://github.com/guardrail-dev/guardrail-sample-sbt-http4s-zio))
+
+Generating clients
+==================
+
+As we've seen in [Generating a Server](scala/http4s/README.md#generating-a-server), guardrail-generated servers establish a mapping between our business logic and a cordoned off subset of HTTP. This permits us to focus on our business logic, without getting overloaded with the complexities of managing such a large protocol. The same is true with guardrail generated HTTP Clients: from a consumer's standpoint, HTTP calls should look like regular function calls, accepting domain-specific arguments and producing domain-specific results.
+
+By generating minimal clients that only have enough business knowledge to map domain types to and from HTTP, opportunities for logical errors are effectively removed. While this does not eliminate logical errors entirely, establishing a firm boundary between the underlying protocol and hand-written code drastically reduces the scope of possible bugs.
+
+The following is an example from the [http4s](https://github.com/http4s/http4s) client generator:
+
+```scala mdoc:passthrough
+import dev.guardrail.docs._
+DocsHelpers.renderScalaSnippet("http4s", GeneratingClients)(
+ """|// Two constructors are provided, one accepting the `httpClient` and `Async`
+ |// implicitly, the other accepting an explicit `httpClient`, but still
+ |// accepting the `Async` implicitly
+ """.stripMargin,
+ ""
+)
+```
+
+(See it in action: [guardrail-dev/guardrail-sample-http4s](https://github.com/guardrail-dev/guardrail-sample-http4s), [guardrail-dev/guardrail-sample-sbt-http4s-zio](https://github.com/guardrail-dev/guardrail-sample-sbt-http4s-zio))
+
+Separation of protocol-concerns from API-level concerns
+-------------------------------------------------------
+
+As guardrail clients are built on top of any Http4s client type, client configuration is done the same way as you are
+already familiar with when using Http4s.
+
+Check out the docs for [Http4s Clients](https://http4s.org/v0.23/client/).
+
+[Prev: Generating a Server](generating-a-server)
diff --git a/docs/scala/http4s/_sidebar.md b/docs/scala/http4s/_sidebar.md
new file mode 100644
index 0000000000..0d56e52fe1
--- /dev/null
+++ b/docs/scala/http4s/_sidebar.md
@@ -0,0 +1,7 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+ - [http](scala/http4s/README.md)
+- [Java](java/README.md)
+- [Extensions](extensions.md)
diff --git a/docs/scala/http4s/dtos.html b/docs/scala/http4s/dtos.html
new file mode 100644
index 0000000000..568fd767a1
--- /dev/null
+++ b/docs/scala/http4s/dtos.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/generating-a-server.html b/docs/scala/http4s/generating-a-server.html
new file mode 100644
index 0000000000..d108582558
--- /dev/null
+++ b/docs/scala/http4s/generating-a-server.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/generating-clients.html b/docs/scala/http4s/generating-clients.html
new file mode 100644
index 0000000000..b40c26dcf5
--- /dev/null
+++ b/docs/scala/http4s/generating-clients.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/guardrail-extensions.html b/docs/scala/http4s/guardrail-extensions.html
new file mode 100644
index 0000000000..13c89fa987
--- /dev/null
+++ b/docs/scala/http4s/guardrail-extensions.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/index.html b/docs/scala/http4s/index.html
new file mode 100644
index 0000000000..791fd16ac4
--- /dev/null
+++ b/docs/scala/http4s/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/installation.html b/docs/scala/http4s/installation.html
new file mode 100644
index 0000000000..3906f083ec
--- /dev/null
+++ b/docs/scala/http4s/installation.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/sample-api-specification.html b/docs/scala/http4s/sample-api-specification.html
new file mode 100644
index 0000000000..c8f88a8ac1
--- /dev/null
+++ b/docs/scala/http4s/sample-api-specification.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/http4s/what-is-guardrail.html b/docs/scala/http4s/what-is-guardrail.html
new file mode 100644
index 0000000000..c0c867ba11
--- /dev/null
+++ b/docs/scala/http4s/what-is-guardrail.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/index.html b/docs/scala/index.html
new file mode 100644
index 0000000000..75767dcf7d
--- /dev/null
+++ b/docs/scala/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ Page Redirection
+
+
+ If you are not redirected automatically, follow this link to example.
+
+
diff --git a/docs/scala/pekko-http/README.md b/docs/scala/pekko-http/README.md
new file mode 100644
index 0000000000..5de0c10057
--- /dev/null
+++ b/docs/scala/pekko-http/README.md
@@ -0,0 +1,3 @@
+## pekko-http
+
+Pekko HTTP support is still in prerelease, though you can try it out following the example [here](https://github.com/guardrail-dev/guardrail-sample-sbt-pekkohttp/pull/1), with the full sample project here: [guardrail-dev/guardrail-sample-sbt-pekkohttp](https://github.com/guardrail-dev/guardrail-sample-sbt-pekkohttp)
diff --git a/docs/scala/pekko-http/_sidebar.md b/docs/scala/pekko-http/_sidebar.md
new file mode 100644
index 0000000000..e6491d9931
--- /dev/null
+++ b/docs/scala/pekko-http/_sidebar.md
@@ -0,0 +1,7 @@
+- [Home](/)
+- [What is guardrail?](about.md)
+- [Sample API Specification](sample-spec.md)
+- [Scala](scala/README.md)
+ - [pekko-http](scala/pekko-http/README.md)
+- [Java](java/README.md)
+- [Extensions](extensions.md)
diff --git a/modules/core/src/main/scala/dev/guardrail/runner/GuardrailRunner.scala b/modules/core/src/main/scala/dev/guardrail/runner/GuardrailRunner.scala
index 972c4d54b9..9bb96a7475 100644
--- a/modules/core/src/main/scala/dev/guardrail/runner/GuardrailRunner.scala
+++ b/modules/core/src/main/scala/dev/guardrail/runner/GuardrailRunner.scala
@@ -24,4 +24,7 @@ abstract class GuardrailRunner {
.productL(Target.pushLogger(StructuredLogger.reset))
)
} yield result
+
+ def unsafeGuardrailRunner(language: String, args: Array[Args]): Array[Path] =
+ Target.unsafeExtract(guardrailRunner(language, args)).toArray
}
diff --git a/modules/microsite/build.sbt b/modules/microsite/build.sbt
deleted file mode 100644
index b1c7597c6f..0000000000
--- a/modules/microsite/build.sbt
+++ /dev/null
@@ -1,54 +0,0 @@
-enablePlugins(MicrositesPlugin)
-micrositePushSiteWith := GitHub4s
-micrositeGithubToken := Option(System.getenv("MICROSITE_PUBLISH_TOKEN"))
-
-micrositeName := "guardrail"
-micrositeDescription := "Principled code generation from OpenAPI specifications"
-micrositeUrl := "https://guardrail.dev/"
-micrositeAuthor := "guardrail.dev"
-micrositeOrganizationHomepage := "https://guardrail.dev/"
-micrositeTwitter := "@guardrail_code"
-micrositeTwitterCreator := "@guardrail_dev"
-micrositeGithubOwner := "guardrail-dev"
-micrositeGithubRepo := "guardrail"
-micrositeHighlightLanguages ++= Seq("yaml", "scala")
-micrositeGitterChannel := false
-micrositeAnalyticsToken := "UA-154175369-1"
-micrositeGoogleAnalytics4Token := "G-L51EVMQF15"
-micrositeTheme := "light"
-mdocIn := baseDirectory.value / "docs"
-//micrositeDataDirectory := baseDirectory.value / "docs" / "data"
-//micrositeImgDirectory := baseDirectory.value / "docs" / "images"
-
-micrositeDocumentationLabelDescription := "Documentation"
-micrositeDocumentationUrl := "docs"
-micrositeHomeButtonTarget := "docs"
-micrositeBaseUrl := "."
-
-// micrositeCssDirectory
-// micrositeExternalIncludesDirectory
-// micrositeExternalLayoutsDirectory
-// micrositeJsDirectory
-// micrositePluginsDirectory
-// micrositeStaticDirectory
-
-// micrositeCDNDirectives
-// micrositeConfig
-// micrositeConfigYaml
-// micrositeEditButton
-// micrositeExtraMdFiles
-// micrositeExtraMdFilesOutput
-// micrositeFavicons
-// micrositeFooterText
-// micrositeGitHostingService
-// micrositeGitHostingUrl
-// micrositeGithubLinks
-// micrositeGitterChannelUrl
-// micrositeHighlightTheme
-// micrositeHomepage
-// micrositeMakeExtraMdFiles
-// micrositeOrganizationHomepage
-// micrositePalette
-// micrositeShareOnSocial
-// micrositeTutExtraMdFiles
-// micrositeTwitter
diff --git a/modules/microsite/docs/docs/index.md b/modules/microsite/docs/docs/index.md
deleted file mode 100644
index 8e8ac53074..0000000000
--- a/modules/microsite/docs/docs/index.md
+++ /dev/null
@@ -1,15 +0,0 @@
----
-layout: docs
-title: Getting started
-section: page
----
-
-Getting started:
-- Scala
- - [akka-http](scala/akka-http)
- - [akka-http-jackson](scala/akka-http-jackson)
- - [http4s](scala/http4s)
- - [dropwizard](scala/dropwizard)
-- Java
- - [dropwizard](java/dropwizard)
- - [spring-mvc](java/spring-mvc)
diff --git a/modules/microsite/docs/docs/java/dropwizard/generating-clients.md b/modules/microsite/docs/docs/java/dropwizard/generating-clients.md
deleted file mode 100644
index 6ebc3ce06a..0000000000
--- a/modules/microsite/docs/docs/java/dropwizard/generating-clients.md
+++ /dev/null
@@ -1,47 +0,0 @@
----
-layout: docs
-title: "Generating Clients - java - dropwizard - guardrail"
----
-
-To generate client code with maven please include following plugin to your pom.xml:
-```xml
-
-
-
- dev.guardrail
- guardrail-maven-plugin_2.12
- 0.62.0
-
-
- generate-app-server
-
- generate-sources
-
-
- java
- dropwizard
- client
- spec.oas3.yaml
- demowizard.client.generated
-
-
-
-
- (...)
-
-
-```
-
-For JDK9+ you also need to add [`javax.annotation:javax.annotation-api`](https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/) dependency:
-
-```xml
-
-
- javax.annotation
- javax.annotation-api
- 1.3.2
-
-
-```
-
-(See it in action: [guardrail-dev/guardrail-sample-maven-dropwizard](https://github.com/guardrail-dev/guardrail-sample-maven-dropwizard))
diff --git a/modules/microsite/docs/docs/java/dropwizard/index.md b/modules/microsite/docs/docs/java/dropwizard/index.md
deleted file mode 100644
index d4259ea061..0000000000
--- a/modules/microsite/docs/docs/java/dropwizard/index.md
+++ /dev/null
@@ -1,27 +0,0 @@
----
-layout: docs
-title: "dropwizard - java - guardrail"
----
-
-Table of Contents
-=================
-
-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 a Server](generating-a-server)
- 1. [Setup](generating-a-server#setup)
- 1. [Server Handlers, Resources](generating-a-server#server-handlers-resources)
- 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 clients](generating-clients)
-
-Java Dropwizard
----------------
-
-Support for Dropwizard 1.3 has been available since guardrail v0.45.0.
-
-Using guardrail you can generate server definions and http clients.
diff --git a/modules/microsite/docs/docs/java/dropwizard/installation.md b/modules/microsite/docs/docs/java/dropwizard/installation.md
deleted file mode 100644
index df037761c2..0000000000
--- a/modules/microsite/docs/docs/java/dropwizard/installation.md
+++ /dev/null
@@ -1,55 +0,0 @@
----
-layout: docs
-title: "Installation - java - dropwizard - guardrail"
----
-
-Installation
-============
-
-guardrail is available as a modular core, with both [sbt](https://github.com/guardrail-dev/sbt-guardrail) and [Maven](https://github.com/guardrail-dev/guardrail-maven-plugin) integration. The core can also be run as a stand-alone [CLI](https://github.com/guardrail-dev/guardrail/blob/978a92db3dd46812aa19f05050995f864cbb5bb3/build.sbt#L33-L48) application, with full support for all features.
-
-guardrail for Dropwizard is generally set up using the maven plugin. This will generate your server or client at build time.
-The following is an example invocation in a `pom.xml` file:
-
-```xml
-
-
-
- dev.guardrail
- guardrail-maven-plugin_2.12
- 0.62.0
-
-
- generate-app-server
-
- generate-sources
-
-
- java
- dropwizard
- server
- server-spec.yaml
- demowizard.generated
-
-
-
-
- (...)
-
-
-```
-
-For JDK9+ you also need to add [`javax.annotation:javax.annotation-api`](https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/) dependency:
-
-```xml
-
-
- javax.annotation
- javax.annotation-api
- 1.3.2
-
-
-```
-
-[Prev: What is guardrail?](what-is-guardrail)
-[Next: Sample API specification](sample-api-specification)
diff --git a/modules/microsite/docs/docs/java/dropwizard/sample-api-specification.md b/modules/microsite/docs/docs/java/dropwizard/sample-api-specification.md
deleted file mode 100644
index a47bd74108..0000000000
--- a/modules/microsite/docs/docs/java/dropwizard/sample-api-specification.md
+++ /dev/null
@@ -1,87 +0,0 @@
----
-layout: docs
-title: "Sample API Specification - java - dropwizard - guardrail"
----
-
-Sample API specification
-========================
-
-The following is a complete, annotated OpenAPI specification file: (guardrail extensions are documented in [guardrail Extensions](../../scala/akka-http/guardrail-extensions))
-
-
-```yaml
-openapi: 3.0.0 # Version of Swagger/OpenAPI of this file
-info: # Primarily for consumption by documentation generation tools
- title: My Service
- version: 0.1.0
-servers: # List of hosts (and ports) where generated clients should connect to
- - url: http://localhost:1234
-paths: # All HTTP Paths are children of this `paths` field
- "/user/{id}": # Paths can have variables in them
- get: # HTTP Method
- operationId: getUser # Friendly name, will be the method name in generated clients and servers
- x-jvm-package: users # Relative package for this client to live in
- parameters: # All parameters (including path parameters) are listed here.
- - name: id # Field name, case sensitive
- in: path # where the parameter will be found.
- description: The ID of the user # description of the parameter. Not used in guardrail, but other tools may consume it
- required: true # required fields can not be missing. Optional fields will become `Optional`
- schema:
- type: string # One of the primitive types supported in the OpenAPI specification.
- x-java-type: CustomString # Escape hatch to explicitly introduce a custom type. This is an
- # advanced technique to introduce completely custom
- # marshalling/unmarshalling/validation logic. Keep in mind, everyone
- # else will just see a plain string!
-
- responses: # All response codes that are possible for this path are listed here
- "200": # Each HTTP status code is mapped to the corresponding textual representation
- description: ""
- content:
- "application/json": # the Content-Type of the return value. Java guardrail will use jackson for converting json
- schema:
- $ref: "#/components/schemas/User" # a reference to elsewhere in this spec for a definition of the response body
- "404": # failure responses must be declared
- description: Not found # description isn't used by guardrail but is useful to indiciate we return no body for this response
-components: # reusable sections of the spec can be described under `components`
- schemas:
- User: # This identifies a symbolic structure name. Not all names are
- # translated into classes when rendered, depending on whether they
- # identify classes with structure, or defer to standard classes
- # like `Vector` for `type: array`.
- type: object # will generate a `User` case class in the `definitions` package
- required: # A list of which parameters are required. This is enforced for
- # clients by having non-optional parameters, and for servers by
- # ensuring all submitted data to the endpoint validates the schema
- # before getting to your `Handler` function.
- - id # These names must match the `properties` names exactly
- - user_addresses
- properties:
- id: # Case matters for `properties`! A heuristic determines whether it's
- # possible to translate a property name into a unique, non-reserved
- # camelCase identifier.
- type: string # One of the primitive types supported in the OpenAPI specification.
- user_addresses: # Similar to `id`, though `user_addresses` can be safely transformed into
- # `userAddress`, so this is done to expose idiomatic Java. The underlying
- # marshallers and unmarshallers maintain this mapping for you though,
- # so no chance of protocol violations.
- $ref: "#/components/schemas/UserAddresses" # Ensures that the type of `userAddress` will be `List`
- UserAddresses:
- type: array
- items:
- $ref: "#/components/schemas/UserAddress" # `items` is a special key for `type: array`, identifying the structure of the
- # sequence members
- UserAddress:
- type: object
- properties:
- line1:
- type: string
- line2:
- type: string
- line3:
- type: string
-
-```
-
-
-[Prev: Installation](installation)
-[Next: Generating a Server](generating-a-server)
diff --git a/modules/microsite/docs/docs/java/dropwizard/what-is-guardrail.md b/modules/microsite/docs/docs/java/dropwizard/what-is-guardrail.md
deleted file mode 100644
index 4472c4639e..0000000000
--- a/modules/microsite/docs/docs/java/dropwizard/what-is-guardrail.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-layout: docs
-title: "What is guardrail? - java - dropwizard - guardrail"
----
-
-What is guardrail?
-==================
-
-guardrail is a code generation tool, capable of reading from OpenAPI/Swagger specification files and generating Java source code for HTTP clients and backend frameworks like Dropwizard and Sprint MVC.
-
-guardrail has three primary goals:
-
-- Documentation: Single point of truth for the interface to a software system
-- Better Servers: Unexpected API changes surface as compiler errors via server routing layer code generation
-- Better Clients: Fewer binary dependencies via client library code generation
-
-Describing software is tricky. Incomplete specifications, slippage between specification and implementation, or even additional semantics of infrastructure that aren't easily communicated through static documents; these are only a few challenges you'll face when attempting to write a specification for your API. A reasonable question you may be asking is what motivations are there for going through these cumbersome and often frustrating tasks? We'll investigate some answers to this question in the following sections.
-
-Single Point of Truth
----------------------
-
-By describing the shape of an API statically, there are far fewer variables to worry about. HTTP is a _very_ flexible protocol, with many features. By constraining that protocol to a subset that expresses the interface to our server (or service, or microservice), we drastically reduce the burden of handling the entirety of HTTP to the core terms of our API. Focus on semantics of APIs once the basics (routing, data validation) are figured out.
-
-A secondary benefit of static specifications lies in tooling. Hand-written routing logic can hide security holes, miss best practices, and obscure intent if written incorrectly. This problem is multipled across as many different languages as are supported inside any given company, manifesting as wasted effort implementing the same feature in different languages, or a bug that only occurs 10 percent of the time due to a buggy golang client.
-
-Attempting to derive what the attack surface of a server is from the implementation is often the job of entire teams in large companies, and even that may not be enough. Conversely, with a static specification, those teams can build intelligent traffic analysis tools to detect anomalies or intentionally malicious clients built to inject bad data to find bugs.
-
-Unexpected API changes are compiler errors
-------------------------------------------
-
-Once we have a specification, generating traits (or abstract classes) with unimplemented members gives us another powerful tool: New or changed parameters become compiler errors.
-
-After constraining our vocabulary to a subset of HTTP that serves our business need, even saying "This parameter is optional" forces us to contend with the sudden appearance of `Optional` parameters in our generated `Handler` methods.
-
-Once specified, `-Werror` helpfully points out that we've forgotten to reflect this most recent change in our tests. A win on both fronts!
-
-Fewer binary dependencies
-----------------------
-
-Traditionally written and maintained client libraries invariably accumulate cruft. In many cases, this is intended to be helpful: papering over a poorly designed API by providing custom logic, renaming parameters to be more convenient, or including properly configured HTTP clients that express retry and backoff semantics the library author provided based on the business requirements known at the time of writing.
-
-Altering the shape of an API by providing a thick HTTP client reduces the shared terminology between service maintainers and their consumers, or even between consumers coming from different languages.
-
-Additionally, by hardcoding even a well-behaved HTTP client into a client library, now consumers are forced to work around that dependency. This may manifest as learning how to use and configure a brand new HTTP client under time pressure, or writing and maintaining brittle [Application Binary Interface (ABI)](https://en.wikipedia.org/wiki/Application_binary_interface)-compatible adapter layers that attempt to use the configuration already present in the rest of the codebase.
-
-Once these bespoke HTTP client configurations are built, both they and their dependencies are now added to the grab bag of dependency versions that must be maintained through the life of any given piece of infrastructure. This presents hidden barriers for upgrading all dependencies, as the possibility of transitive dependency conflicts increase as dependency trees become deeper.
-
-[Next: Installation](installation)
diff --git a/modules/microsite/docs/docs/java/index.md b/modules/microsite/docs/docs/java/index.md
deleted file mode 100644
index 98cc8c92a8..0000000000
--- a/modules/microsite/docs/docs/java/index.md
+++ /dev/null
@@ -1,35 +0,0 @@
----
-layout: docs
-title: "java - guardrail"
----
-
-guardrail can generate Java clients and servers for the following
-frameworks:
-
-* [`dropwizard`](dropwizard/)
-* [`spring-mvc`](spring-mvc/)
-
-In addition, the Java generation backend supports use of either standard
-Java collections types (such as `java.util.Optional` and
-`java.util.Map`), or [Vavr](https://vavr.io/) collections types (such as
-`io.vavr.control.Option` and `io.vavr.collection.Vector`). Vavr's
-collection types are more internally consistent and attempt to provide
-an interface familiar to functional programmers. Scala developers will
-find their APIs especially familiar.
-
-To make use of the Vavr generation, you need to instead use guardrail's
-module system. Instead of specifying a `framework`, instead specify a
-series of `module`s that describe the framework, protocol, and
-collectsions library generators to use. For example, if I were using
-the guardrail Maven plugin, and wanted to use Vavr with Dropwizard, I'd
-include in my ``:
-
-```xml
-
- java-vavr
- jackson
- dropwizard
-
-```
-
-Currently, Vavr is only supported with the `dropwizard` framework.
diff --git a/modules/microsite/docs/docs/scala/akka-http/dtos.md b/modules/microsite/docs/docs/scala/akka-http/dtos.md
deleted file mode 100644
index abb9646780..0000000000
--- a/modules/microsite/docs/docs/scala/akka-http/dtos.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-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.
diff --git a/modules/microsite/docs/docs/scala/akka-http/generating-clients.md b/modules/microsite/docs/docs/scala/akka-http/generating-clients.md
deleted file mode 100644
index 810a6fae73..0000000000
--- a/modules/microsite/docs/docs/scala/akka-http/generating-clients.md
+++ /dev/null
@@ -1,61 +0,0 @@
----
-layout: docs
-title: "Generating Clients - akka-http - scala - guardrail"
----
-
-Generating clients
-==================
-
-As we've seen in [Generating a Server](generating-a-server), guardrail-generated servers establish a mapping between our business logic and a cordoned off subset of HTTP. This permits us to focus on our business logic, without getting overloaded with the complexities of managing such a large protocol. The same is true with guardrail generated HTTP Clients: from a consumer's standpoint, HTTP calls should look like regular function calls, accepting domain-specific arguments and producing domain-specific results.
-
-By generating minimal clients that only have enough business knowledge to map domain types to and from HTTP, opportunities for logical errors are effectively removed. While this does not eliminate logical errors entirely, establishing a firm boundary between the underlying protocol and hand-written code drastically reduces the scope of possible bugs.
-
-The following is an example from the [akka-http](https://github.com/akka/akka-http) client generator:
-
-```scala mdoc:passthrough
-import dev.guardrail.docs._
-DocsHelpers.renderScalaSnippet("akka-http", GeneratingClients)(
- """|// Two constructors are provided, one accepting the `httpClient`,
- |// `ExecutionContext`, and `Materializer` implicitly, the other accepting
- |// an explicit `httpClient`, but still accepting the `ExecutionContext` and
- |// `Materializer` as implicits.
- """.stripMargin,
- ""
-)
-```
-
-(See it in action: [guardrail-dev/guardrail-sample-sbt-akkahttp](https://github.com/guardrail-dev/guardrail-sample-sbt-akkahttp))
-
-Separation of protocol-concerns from API-level concerns
--------------------------------------------------------
-
-As guardrail clients are built on top of the function type `HttpRequest => Future[HttpResponse]`, client configuration is reduced to function composition. Some ideas:
-
-```scala
-val singleRequestHttpClient = { (req: HttpRequest) =>
- Http().singleRequest(req)
-}
-
-val retryingHttpClient = { nextClient: (HttpRequest => Future[HttpResponse]) =>
- req: HttpRequest => nextClient(req).flatMap(resp => if (resp.status.intValue >= 500) nextClient(req) else Future.successful(resp))
-}
-
-val metricsHttpClient = { nextClient: (HttpRequest => Future[HttpResponse]) =>
- req: HttpRequest => {
- val resp = nextClient(req)
- resp.onSuccess { _resp =>
- trackMetrics(req.uri.path, _resp.status)
- }
- resp
- }
-}
-
-// Track metrics for every request, even retries
-val retryingMetricsClient1: HttpRequest => Future[HttpResponse] = retryingHttpClient(metricsHttpClient(singleRequestHttpClient))
-
-// Only track metrics for requests we didn't have to retry
-val retryingMetricsClient2: HttpRequest => Future[HttpResponse] = metricsHttpClient(retryingHttpClient(singleRequestHttpClient))
-```
-
-[Prev: Generating a Server](generating-a-server)
-[Next: guardrail Extensions](guardrail-extensions)
diff --git a/modules/microsite/docs/docs/scala/akka-http/index.md b/modules/microsite/docs/docs/scala/akka-http/index.md
deleted file mode 100644
index 2ce8bf4263..0000000000
--- a/modules/microsite/docs/docs/scala/akka-http/index.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-layout: docs
-title: "akka-http - scala - guardrail"
----
-
-Table of Contents
-=================
-
-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)
diff --git a/modules/microsite/docs/docs/scala/akka-http/installation.md b/modules/microsite/docs/docs/scala/akka-http/installation.md
deleted file mode 100644
index 1cd7529384..0000000000
--- a/modules/microsite/docs/docs/scala/akka-http/installation.md
+++ /dev/null
@@ -1,24 +0,0 @@
----
-layout: docs
-title: "Installation - akka-http - scala - guardrail"
----
-
-Installation
-============
-
-guardrail is available as a modular core, with both [sbt](https://github.com/guardrail-dev/sbt-guardrail) and [Maven](https://github.com/guardrail-dev/guardrail-maven-plugin) integration. The core can also be run as a stand-alone [CLI](https://github.com/guardrail-dev/guardrail/blob/978a92db3dd46812aa19f05050995f864cbb5bb3/build.sbt#L33-L48) application, with full support for all features.
-
-If compiling with Scala < 2.13.x, you'll need to enable `-Ypartial-unification`:
-
-```scala
-scalacOptions += "-Ypartial-unification"
-```
-
-If compiling with Scala < 2.12.x, you'll additionally need the `-Xexperimental` flag:
-
-```scala
-scalacOptions += "-Xexperimental"
-```
-
-[Prev: What is guardrail?](what-is-guardrail)
-[Next: Sample API specification](sample-api-specification)
diff --git a/modules/microsite/docs/docs/scala/akka-http/what-is-guardrail.md b/modules/microsite/docs/docs/scala/akka-http/what-is-guardrail.md
deleted file mode 100644
index eeefcc51c2..0000000000
--- a/modules/microsite/docs/docs/scala/akka-http/what-is-guardrail.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-layout: docs
-title: "What is guardrail? - akka-http - scala - guardrail"
----
-
-What is guardrail?
-==================
-
-guardrail is a code generation tool, capable of reading from OpenAPI/Swagger specification files and generating Scala source code, primarily targeting the akka-http and http4s web frameworks, using circe for JSON encoding/decoding.
-
-guardrail has three primary goals:
-
-- Documentation: Single point of truth for the interface to a software system
-- Better Servers: Unexpected API changes surface as compiler errors via server routing layer code generation
-- Better Clients: Fewer binary dependencies via client library code generation
-
-Describing software is tricky. Incomplete specifications, slippage between specification and implementation, or even additional semantics of infrastructure that aren't easily communicated through static documents; these are only a few challenges you'll face when attempting to write a specification for your API. A reasonable question you may be asking is what motivations are there for going through these cumbersome and often frustrating tasks? We'll investigate some answers to this question in the following sections.
-
-Single Point of Truth
----------------------
-
-By describing the shape of an API statically, there are far fewer variables to worry about. HTTP is a _very_ flexible protocol, with many features. By constraining that protocol to a subset that expresses the interface to our server (or service, or microservice), we drastically reduce the burden of handling the entirety of HTTP to the core terms of our API. Focus on semantics of APIs once the basics (routing, data validation) are figured out.
-
-A secondary benefit of static specifications lies in tooling. Hand-written routing logic can hide security holes, miss best practices, and obscure intent if written incorrectly. This problem is multipled across as many different languages as are supported inside any given company, manifesting as wasted effort implementing the same feature in different languages, or a bug that only occurs 10 percent of the time due to a buggy golang client.
-
-Attempting to derive what the attack surface of a server is from the implementation is often the job of entire teams in large companies, and even that may not be enough. Conversely, with a static specification, those teams can build intelligent traffic analysis tools to detect anomalies or intentionally malicious clients built to inject bad data to find bugs.
-
-Unexpected API changes are compiler errors
-------------------------------------------
-
-Once we have a specification, generating traits (or abstract classes) with unimplemented members gives us another powerful tool: New or changed parameters become compiler errors.
-
-After constraining our vocabulary to a subset of HTTP that serves our business need, even saying "This parameter is optional" forces us to contend with the sudden appearance of `Option[T]` parameters in our generated `Handler` methods.
-
-Once specified, `-Ywarn-unused` helpfully points out that we've forgotten to reflect this most recent change in our tests. A win on both fronts!
-
-Fewer binary dependencies
-----------------------
-
-Traditionally written and maintained client libraries invariably accumulate cruft. In many cases, this is intended to be helpful: papering over a poorly designed API by providing custom logic, renaming parameters to be more convenient, or including properly configured HTTP clients that express retry and backoff semantics the library author provided based on the business requirements known at the time of writing.
-
-Altering the shape of an API by providing a thick HTTP client reduces the shared terminology between service maintainers and their consumers, or even between consumers coming from different languages.
-
-Additionally, by hardcoding even a well-behaved HTTP client into a client library, now consumers are forced to work around that dependency. This may manifest as learning how to use and configure a brand new HTTP client under time pressure, or writing and maintaining brittle [Application Binary Interface (ABI)](https://en.wikipedia.org/wiki/Application_binary_interface)-compatible adapter layers that attempt to use the configuration already present in the rest of the codebase.
-
-Once these bespoke HTTP client configurations are built, both they and their dependencies are now added to the grab bag of dependency versions that must be maintained through the life of any given piece of infrastructure. This presents hidden barriers for upgrading all dependencies, as the possibility of transitive dependency conflicts increase as dependency trees become deeper.
-
-[Next: Installation](installation)
diff --git a/modules/microsite/docs/docs/scala/http4s/dtos.md b/modules/microsite/docs/docs/scala/http4s/dtos.md
deleted file mode 100644
index da5cd4ffd6..0000000000
--- a/modules/microsite/docs/docs/scala/http4s/dtos.md
+++ /dev/null
@@ -1,10 +0,0 @@
----
-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.
diff --git a/modules/microsite/docs/docs/scala/http4s/generating-a-server.md b/modules/microsite/docs/docs/scala/http4s/generating-a-server.md
deleted file mode 100644
index 7877cef581..0000000000
--- a/modules/microsite/docs/docs/scala/http4s/generating-a-server.md
+++ /dev/null
@@ -1,64 +0,0 @@
----
-layout: docs
-title: "Generating a Server - http4s - scala - guardrail"
----
-
-Generating a Server
-===================
-
-guardrail-generated servers come in two parts: a `Resource` and a `Handler`. The `Resource` contains all the routing logic, accepting a `Handler` as an argument to the `route` function in order to provide an HTTP service in whichever supported HTTP framework you're hosting your service in.
-
-The following is an example from the [http4s](https://github.com/http4s/http4s) server generator:
-
-```scala mdoc:passthrough
-import dev.guardrail.docs._
-DocsHelpers.renderScalaSnippet("http4s", GeneratingAServer)("""
- |// The `Handler` trait is fully abstracted from the underlying http framework. As a result, with the exception of some
- |// structural alterations (`F[_]` instead of `Future[_]` as the return type) the same handlers can be used with
- |// different `Resource` implementations from different framework generators. This permits greater compatibility between
- |// different frameworks without changing your business logic.
- """.stripMargin,
- ""
-)
-```
-
-As all parameters are provided as arguments to the function stubs in the trait, there's no concern of forgetting to extract a query string parameter or introducing a typo in a form parameter name.
-
-The routes and resources generated by guardrail can be hooked up into your HTTP4s server like so:
-
-```scala
-import org.http4s.ember.server.EmberServerBuilder
-
-class UserImpl extends UserHandler[IO] { /* Your code here */ }
-val userHandler: UserHandler[IO] = new UserImpl
-val usersService = new UsersResource[IO]().routes(userHandler)
-val httpApp = usersService.orNotFound
-
-// Same basic server setup as in the http4s quickstart
-EmberServerBuilder.default[IO]
- .withHttpApp(httpApp)
- .build
- .use(_ => IO.never)
- .as(ExitCode.Success)
-```
-
-(See it in action: [guardrail-dev/guardrail-sample-http4s](https://github.com/guardrail-dev/guardrail-sample-http4s), [guardrail-dev/guardrail-sample-sbt-http4s-zio](https://github.com/guardrail-dev/guardrail-sample-sbt-http4s-zio))
-
-Separation of business logic
-----------------------------
-
-Providing an implementation of a function with a well-defined set of inputs and outputs is natural for any developer. By reducing the scope of the interface a developer writes against, implementations are more clear and concise.
-
-Furthermore, by providing business logic as an implementation of an abstract class, unit tests can test the routing layer and business logic independently, by design.
-
-API structure slip is impossible
---------------------------------
-
-As parameters are explicitly provided as arguments to functions in `Handler`s, any alteration to parameters constitute a new function interface that must be implemented. As a result, if providing an implementation for an externally managed specification, the compiler informs when a previously written function is no longer sufficient.
-
-By representing different response codes and structures as members of a sealed trait, it's impossible to return a structure that violates the specification, even for less frequently used response codes.
-
-Finally, describing an endpoint in your specification without providing an implementation for it is a compiler error. This prevents reduction of functionality due to refactors, human error, or miscommunication with other teams.
-
-[Prev: Sample API specification](sample-api-specification)
-[Next: Generating clients](generating-clients)
diff --git a/modules/microsite/docs/docs/scala/http4s/generating-clients.md b/modules/microsite/docs/docs/scala/http4s/generating-clients.md
deleted file mode 100644
index 97ee3b0c41..0000000000
--- a/modules/microsite/docs/docs/scala/http4s/generating-clients.md
+++ /dev/null
@@ -1,36 +0,0 @@
----
-layout: docs
-title: "Generating Clients - http4s - scala - guardrail"
----
-
-Generating clients
-==================
-
-As we've seen in [Generating a Server](generating-a-server), guardrail-generated servers establish a mapping between our business logic and a cordoned off subset of HTTP. This permits us to focus on our business logic, without getting overloaded with the complexities of managing such a large protocol. The same is true with guardrail generated HTTP Clients: from a consumer's standpoint, HTTP calls should look like regular function calls, accepting domain-specific arguments and producing domain-specific results.
-
-By generating minimal clients that only have enough business knowledge to map domain types to and from HTTP, opportunities for logical errors are effectively removed. While this does not eliminate logical errors entirely, establishing a firm boundary between the underlying protocol and hand-written code drastically reduces the scope of possible bugs.
-
-The following is an example from the [http4s](https://github.com/http4s/http4s) client generator:
-
-```scala mdoc:passthrough
-import dev.guardrail.docs._
-DocsHelpers.renderScalaSnippet("http4s", GeneratingClients)(
- """|// Two constructors are provided, one accepting the `httpClient` and `Async`
- |// implicitly, the other accepting an explicit `httpClient`, but still
- |// accepting the `Async` implicitly
- """.stripMargin,
- ""
-)
-```
-
-(See it in action: [guardrail-dev/guardrail-sample-http4s](https://github.com/guardrail-dev/guardrail-sample-http4s), [guardrail-dev/guardrail-sample-sbt-http4s-zio](https://github.com/guardrail-dev/guardrail-sample-sbt-http4s-zio))
-
-Separation of protocol-concerns from API-level concerns
--------------------------------------------------------
-
-As guardrail clients are built on top of any Http4s client type, client configuration is done the same way as you are
-already familiar with when using Http4s.
-
-Check out the docs for [Http4s Clients](https://http4s.org/v0.23/client/).
-
-[Prev: Generating a Server](generating-a-server)
diff --git a/modules/microsite/docs/docs/scala/http4s/guardrail-extensions.md b/modules/microsite/docs/docs/scala/http4s/guardrail-extensions.md
deleted file mode 100644
index d4182dfa65..0000000000
--- a/modules/microsite/docs/docs/scala/http4s/guardrail-extensions.md
+++ /dev/null
@@ -1,191 +0,0 @@
----
-layout: docs
-title: "guardrail extensions - http4s - scala - guardrail"
----
-
-guardrail Extensions
-====================
-
-guardrail has [a number of vendor extensions](https://github.com/twilio/guardrail/blob/cbf9acd9e8ff226cc0f4bbf2f278669071126d5e/modules/codegen/src/main/scala/com/twilio/guardrail/extract/package.scala) designed to enhance safety and provide more idiomatic generated code. The following table lists all vendor extensions, contexts where they are applicable, and a short description of how to use them effectively.
-
-
-
-
-
Extension
-
Type
-
Contexts
-
Description
-
-
-
-
-
x-empty-is-null
-
boolean
-
clients/servers, definitions
-
- Instructs the JSON decoder to convert empty strings to null before
- decoding, causing empty strings to not satisfy the required directive,
- or being represented as None instead of Some("").
-
-
-
-
x-file-hash
-
string
-
servers, parameters, file
-
- During a streaming file upload, keep track of the file hash in one of
- the supported file hash types.
-
-
-
-
x-scala-package
-
string
-
clients/servers, paths
-
- A dot-separated package segment concatenated to the end of the supplied
- packageName when generating Scala code. This permits
- splitting up large specifications into smaller, domain-specific
- Handlers. See also x-jvm-package.
-
-
-
-
x-java-package
-
string
-
clients/servers, paths
-
- A dot-separated package segment concatenated to the end of the supplied
- packageName when generating Java code. This permits
- splitting up large specifications into smaller, domain-specific
- Handlers. See also x-jvm-package.
-
-
-
-
x-jvm-package
-
string
-
clients/servers, paths
-
- A dot-separated package segment concatenated to the end of the supplied
- packageName when generating JVM code. This permits
- splitting up large specifications into smaller, domain-specific
- Handlers. Note that x-scala-package and
- x-java-package take precedence over this property.
-
-
-
-
x-server-raw-response
-
boolean
-
servers, paths
-
- Exposes the underlying HTTP framework's response-building
- infrastructure. Type-safe `respond` wrappers are still generated
- and supplied, though this escape-hatch is intended to work around
- bugs in guardrail itself. This is not recommended for long-term use,
- as no guarantees around compile-time-safe protocol adherence can be
- made.
-
-
-
-
x-tracing-label
-
string
-
clients/servers, paths
-
- When tracing is enabled, override the provided function
- label with a custom string. This string will be supplied to your
- supplied trace function in your servers and your supplied
- traceBuilder in your clients.
-
-
-
-
x-scala-type
-
string
-
definitions, parameters
-
- Override the primitive types specified in the OpenAPI specification
- with a domain-specific type for generated Scala code. This requires the
- type to have either serializers/deserializers in the underlying JSON
- framework or HTTP framework. As this is an advanced feature, it may
- require use of custom imports provided via build tool
- plugins or at the CLI.
-
-
-
-
x-java-type
-
string
-
definitions, parameters
-
- Override the primitive types specified in the OpenAPI specification
- with a domain-specific type for generated Java code. This requires the
- type to have either serializers/deserializers in the underlying JSON
- framework or HTTP framework. As this is an advanced feature, it may
- require use of custom imports provided via build tool
- plugins or at the CLI.
-
-
-
-
x-jvm-type
-
string
-
definitions, parameters
-
- Override the primitive types specified in the OpenAPI specification
- with a domain-specific type for generated JVM (Scala and Java) code.
- This requires the type to have either serializers/deserializers in the
- underlying JSON framework or HTTP framework. As this is an advanced
- feature, it may require use of custom imports provided via
- build tool plugins or at the CLI.
-
-
-
-
x-scala-array-type, x-java-array-type
-
string
-
definitions, parameters
-
- Override the generated array type from `Vector` to some custom type.
- This requires the type to have either serializers/deserializers in the
- underlying JSON framework or HTTP framework. As this is an advanced
- feature, it may require use of custom imports provided via
- build tool plugins or at the CLI.
-
-
-
-
x-scala-map-type, x-java-map-type
-
string
-
definitions, parameters
-
- Override the generated map type from `Map` to some custom type.
- This requires the type to have either serializers/deserializers in the
- underlying JSON framework or HTTP framework. As this is an advanced
- feature, it may require use of custom imports provided via
- build tool plugins or at the CLI.
-
-
-
-
x-scala-class-prefix
-
string
-
clients/servers
-
- An arbitrary class name prefix that overrides the default class name
- when generating Scala code. See also x-jvm-class-prefix.
-
-
-
-
x-java-class-prefix
-
string
-
clients/servers
-
- An arbitrary class name prefix that overrides the default class name
- when generating Java code. See also x-jvm-class-prefix.
-
-
-
-
x-jvm-class-prefix
-
string
-
clients/servers
-
- An arbitrary class name prefix that overrides the default class name
- when generating JVM code. See also x-scala-class-prefix.
-