Merge branch '1.1.x' into 1.2.x
This commit is contained in:
@@ -42,5 +42,5 @@ with regard to the reporter of an incident.
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][1], version 1.3.0, available
|
||||
at [contributor-covenant.org/version/1/3/0/][2].
|
||||
|
||||
[1]: http://contributor-covenant.org
|
||||
[2]: http://contributor-covenant.org/version/1/3/0/
|
||||
[1]: https://contributor-covenant.org
|
||||
[2]: https://contributor-covenant.org/version/1/3/0/
|
||||
@@ -61,4 +61,4 @@ The project can then be imported into Eclipse using `File -> Import…` and then
|
||||
|
||||
[1]: CODE_OF_CONDUCT.md
|
||||
[2]: https://cla.pivotal.io/sign/spring
|
||||
[3]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
||||
|
||||
@@ -9,7 +9,7 @@ for your RESTful services. However, we can't achieve that goal without your cont
|
||||
[[contributing-questions]]
|
||||
=== Questions
|
||||
|
||||
You can ask questions about Spring REST Docs on http://stackoverflow.com[StackOverflow]
|
||||
You can ask questions about Spring REST Docs on https://stackoverflow.com[StackOverflow]
|
||||
using the `spring-restdocs` tag. Similarly, we encourage you to help your fellow
|
||||
Spring REST Docs users by answering questions.
|
||||
|
||||
|
||||
@@ -1032,11 +1032,11 @@ A number of snippets are produced automatically when you document a request and
|
||||
|Snippet | Description
|
||||
|
||||
| `curl-request.adoc`
|
||||
| Contains the http://curl.haxx.se[`curl`] command that is equivalent to the `MockMvc`
|
||||
| Contains the https://curl.haxx.se[`curl`] command that is equivalent to the `MockMvc`
|
||||
call that is being documented
|
||||
|
||||
| `httpie-request.adoc`
|
||||
| Contains the http://httpie.org[`HTTPie`] command that is equivalent to the `MockMvc`
|
||||
| Contains the https://httpie.org[`HTTPie`] command that is equivalent to the `MockMvc`
|
||||
call that is being documented
|
||||
|
||||
| `http-request.adoc`
|
||||
|
||||
@@ -19,12 +19,12 @@ If you want to jump straight in, a number of sample applications are available:
|
||||
| {samples}/rest-notes-spring-data-rest[Spring Data REST]
|
||||
| Maven
|
||||
| Demonstrates the creation of a getting started guide and an API guide for a service
|
||||
implemented using http://projects.spring.io/spring-data-rest/[Spring Data REST].
|
||||
implemented using https://projects.spring.io/spring-data-rest/[Spring Data REST].
|
||||
|
||||
| {samples}/rest-notes-spring-hateoas[Spring HATEOAS]
|
||||
| Gradle
|
||||
| Demonstrates the creation of a getting started guide and an API guide for a service
|
||||
implemented using http://projects.spring.io/spring-hateoas/[Spring HATEOAS].
|
||||
implemented using https://projects.spring.io/spring-hateoas/[Spring HATEOAS].
|
||||
|
||||
|===
|
||||
|
||||
@@ -54,7 +54,7 @@ If you want to jump straight in, a number of sample applications are available:
|
||||
| {samples}/rest-notes-slate[Slate]
|
||||
| Gradle
|
||||
| Demonstrates the use of Spring REST Docs with Markdown and
|
||||
http://github.com/tripit/slate[Slate].
|
||||
https://github.com/tripit/slate[Slate].
|
||||
|
||||
| {samples}/testng[TestNG]
|
||||
| Gradle
|
||||
@@ -249,7 +249,7 @@ from where it will be included in the jar file.
|
||||
=== Generating documentation snippets
|
||||
Spring REST Docs uses
|
||||
{spring-framework-docs}/#spring-mvc-test-framework[Spring's MVC Test framework] or
|
||||
http://www.rest-assured.io[REST Assured] to make requests to the service that you are
|
||||
http://rest-assured.io/[REST Assured] to make requests to the service that you are
|
||||
documenting. It then produces documentation snippets for the request and the resulting
|
||||
response.
|
||||
|
||||
@@ -440,7 +440,7 @@ the resulting HTML files depends on whether you are using Maven or Gradle:
|
||||
|
||||
The generated snippets can then be included in the manually created Asciidoctor file from
|
||||
above using the
|
||||
http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files[include macro].
|
||||
https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files[include macro].
|
||||
The `snippets` attribute that is automatically set by `spring-restdocs-asciidoctor`
|
||||
configured in the <<getting-started-build-configuration, build
|
||||
configuration>> can be used to reference the snippets output directory. For example:
|
||||
|
||||
@@ -12,8 +12,8 @@ Andy Wilkinson
|
||||
:source: {github}/tree/{branch-or-tag}
|
||||
:samples: {source}/samples
|
||||
:templates: {source}spring-restdocs/src/main/resources/org/springframework/restdocs/templates
|
||||
:spring-boot-docs: http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle
|
||||
:spring-framework-docs: http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle
|
||||
:spring-boot-docs: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle
|
||||
:spring-framework-docs: https://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle
|
||||
|
||||
[[abstract]]
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ services that is accurate and readable.
|
||||
|
||||
Writing high-quality documentation is difficult. One way to ease that difficulty is to use
|
||||
tools that are well-suited to the job. To this end, Spring REST Docs uses
|
||||
http://asciidoctor.org[Asciidoctor] by default. Asciidoctor processes plain text and
|
||||
https://asciidoctor.org[Asciidoctor] by default. Asciidoctor processes plain text and
|
||||
produces HTML, styled and layed out to suit your needs. If you prefer, Spring REST Docs
|
||||
can also be configured to use Markdown.
|
||||
|
||||
Spring REST Docs makes use of snippets produced by tests written with
|
||||
{spring-framework-docs}/#spring-mvc-test-framework[Spring MVC Test] or
|
||||
http://www.rest-assured.io[REST Assured] 2 and 3. This test-driven approach helps to
|
||||
http://rest-assured.io[REST Assured] 2 and 3. This test-driven approach helps to
|
||||
guarantee the accuracy of your service's documentation. If a snippet is incorrect the
|
||||
test that produces it will fail.
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ relevant to Spring REST Docs.
|
||||
[[working-with-asciidoctor-resources]]
|
||||
=== Resources
|
||||
|
||||
* http://asciidoctor.org/docs/asciidoc-syntax-quick-reference[Syntax quick reference]
|
||||
* http://asciidoctor.org/docs/user-manual[User manual]
|
||||
* https://asciidoctor.org/docs/asciidoc-syntax-quick-reference[Syntax quick reference]
|
||||
* https://asciidoctor.org/docs/user-manual[User manual]
|
||||
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ should be `operation-{snippet}-title`. For example, to customize the title of th
|
||||
[[working-with-asciidoctor-including-snippets-individual]]
|
||||
==== Including individual snippets
|
||||
|
||||
The http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files[include
|
||||
The https://asciidoctor.org/docs/asciidoc-syntax-quick-reference/#include-files[include
|
||||
macro] is used to include individual snippets in your documentation. The `snippets`
|
||||
attribute that is automatically set by `spring-restdocs-asciidoctor` configured in the
|
||||
<<getting-started-build-configuration, build configuration>> can be used to reference the
|
||||
@@ -153,7 +153,7 @@ snippet is included or by using a custom snippet template.
|
||||
==== Formatting columns
|
||||
|
||||
Asciidoctor has rich support for
|
||||
http://asciidoctor.org/docs/user-manual/#cols-format[formatting a table's columns]. For
|
||||
https://asciidoctor.org/docs/user-manual/#cols-format[formatting a table's columns]. For
|
||||
example, the widths of a table's columns can be specified using the `cols` attribute:
|
||||
|
||||
[source,indent=0]
|
||||
@@ -200,5 +200,5 @@ in a cell that contains the value of a `description` attribute:
|
||||
|
||||
==== Further reading
|
||||
|
||||
Refer to the http://asciidoctor.org/docs/user-manual/#tables[Tables section of
|
||||
Refer to the https://asciidoctor.org/docs/user-manual/#tables[Tables section of
|
||||
the Asciidoctor user manual] for more information about customizing tables.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## Overview
|
||||
|
||||
This is a sample project using Grails 3, Spock, and Spring REST docs. For more
|
||||
information about the Grails framework please see [grails.org](http://grails.org).
|
||||
information about the Grails framework please see [grails.org](https://grails.org).
|
||||
|
||||
Grails is built on top of Spring Boot and Gradle so there are a few different ways to
|
||||
run this project including:
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import grails.util.BuildSettings
|
||||
import grails.util.Environment
|
||||
|
||||
// See http://logback.qos.ch/manual/groovy.html for details on configuration
|
||||
// See https://logback.qos.ch/manual/groovy.html for details on configuration
|
||||
appender('STDOUT', ConsoleAppender) {
|
||||
encoder(PatternLayoutEncoder) {
|
||||
pattern = "%level %logger - %msg%n"
|
||||
|
||||
@@ -21,4 +21,4 @@ documentation by [ERB][4]. The combined Markdown document is then turned into HT
|
||||
[1]: https://github.com/lord/slate
|
||||
[2]: slate/source/api-guide.html.md.erb
|
||||
[3]: src/test/java/com/example/notes/ApiDocumentation.java
|
||||
[4]: http://ruby-doc.org/stdlib-2.2.3/libdoc/erb/rdoc/ERB.html
|
||||
[4]: https://ruby-doc.org/stdlib-2.2.3/libdoc/erb/rdoc/ERB.html
|
||||
@@ -27,7 +27,7 @@ Features
|
||||
|
||||
* **Let your users update your documentation for you** — By default, your Slate-generated documentation is hosted in a public Github repository. Not only does this mean you get free hosting for your docs with Github Pages, but it also makes it simple for other developers to make pull requests to your docs if they find typos or other problems. Of course, if you don't want to use GitHub, you're also welcome to host your docs elsewhere.
|
||||
|
||||
Getting started with Slate is super easy! Simply fork this repository and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the [sample docs](http://lord.github.io/slate).
|
||||
Getting started with Slate is super easy! Simply fork this repository and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the [sample docs](https://lord.github.io/slate).
|
||||
|
||||
Getting Started with Slate
|
||||
------------------------------
|
||||
@@ -67,18 +67,18 @@ Companies Using Slate
|
||||
|
||||
* [NASA](https://api.nasa.gov)
|
||||
* [IBM](https://docs.cloudant.com/api.html)
|
||||
* [Sony](http://developers.cimediacloud.com)
|
||||
* [Mozilla](http://localforage.github.io/localForage/)
|
||||
* [Sony](https://developers.cimediacloud.com)
|
||||
* [Mozilla](https://localforage.github.io/localForage/)
|
||||
* [Best Buy](https://bestbuyapis.github.io/api-documentation/)
|
||||
* [Travis-CI](https://docs.travis-ci.com/api/)
|
||||
* [Greenhouse](https://developers.greenhouse.io/harvest.html)
|
||||
* [Woocommerce](http://woocommerce.github.io/woocommerce-rest-api-docs/)
|
||||
* [Appium](http://appium.io/slate/en/master)
|
||||
* [Woocommerce](https://woocommerce.github.io/woocommerce-rest-api-docs/)
|
||||
* [Appium](https://appium.io/slate/en/master)
|
||||
* [Dwolla](https://docs.dwolla.com/)
|
||||
* [Clearbit](https://clearbit.com/docs)
|
||||
* [Coinbase](https://developers.coinbase.com/api)
|
||||
* [Parrot Drones](http://developer.parrot.com/docs/bebop/)
|
||||
* [Fidor Bank](http://docs.fidor.de/)
|
||||
* [Parrot Drones](https://developer.parrot.com/docs/bebop/)
|
||||
* [Fidor Bank](https://api-docs.fidor.de)
|
||||
* [Scale](https://docs.scaleapi.com/)
|
||||
|
||||
You can view more in [the list on the wiki](https://github.com/lord/slate/wiki/Slate-in-the-Wild).
|
||||
@@ -100,7 +100,7 @@ Thanks to the following people who have submitted major pull requests:
|
||||
- [@realityking](https://github.com/realityking)
|
||||
- [@cvkef](https://github.com/cvkef)
|
||||
|
||||
Also, thanks to [Sauce Labs](http://saucelabs.com) for helping sponsor the project.
|
||||
Also, thanks to [Sauce Labs](https://saucelabs.com) for helping sponsor the project.
|
||||
|
||||
Special Thanks
|
||||
--------------------
|
||||
@@ -108,4 +108,4 @@ Special Thanks
|
||||
- [jquery.tocify.js](https://github.com/gfranko/jquery.tocify.js)
|
||||
- [middleman-syntax](https://github.com/middleman/middleman-syntax)
|
||||
- [middleman-gh-pages](https://github.com/edgecase/middleman-gh-pages)
|
||||
- [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
|
||||
- [Font Awesome](https://fortawesome.github.io/Font-Awesome/)
|
||||
|
||||
@@ -49,9 +49,9 @@ that describes the problem. The error object has the following structure:
|
||||
## Hypermedia
|
||||
|
||||
RESTful Notes uses hypermedia and resources include links to other resources in their
|
||||
responses. Responses are in [Hypertext Application Language (HAL)](http://stateless.co/hal_specification.html format).
|
||||
Links can be found beneath the `_links` key. Users of the API should not create URIs
|
||||
themselves, instead they should use the above-described links to navigate
|
||||
responses. Responses are in [Hypertext Application Language (HAL)](https://github.com/mikekelly/hal_specification)
|
||||
format. Links can be found beneath the `_links` key. Users of the API should not create
|
||||
URIs themselves, instead they should use the above-described links to navigate
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ under the License.
|
||||
|
||||
key = decodeURIComponent(key);
|
||||
// missing `=` should be `null`:
|
||||
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
||||
// https://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
|
||||
val = val === undefined ? null : decodeURIComponent(val);
|
||||
|
||||
if (!ret.hasOwnProperty(key)) {
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
/**
|
||||
* Special logic for standalone web apps
|
||||
* See http://stackoverflow.com/questions/2898740/iphone-safari-web-app-opens-links-in-new-window
|
||||
* See https://stackoverflow.com/questions/2898740/iphone-safari-web-app-opens-links-in-new-window
|
||||
*/
|
||||
if(standAlone) {
|
||||
window.location = target.getAttribute("href");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* jQuery Highlight plugin
|
||||
*
|
||||
* Based on highlight v3 by Johann Burkard
|
||||
* http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
|
||||
* https://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html
|
||||
*
|
||||
* Code a little bit refactored and cleaned (in my humble opinion).
|
||||
* Most important changes:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* jquery Tocify - v1.8.0 - 2013-09-16
|
||||
* http://www.gregfranko.com/jquery.tocify.js/
|
||||
* http://gregfranko.com/jquery.tocify.js/
|
||||
* Copyright (c) 2013 Greg Franko; Licensed MIT
|
||||
* Modified lightly by Robert Lord to fix a bug I found,
|
||||
* and also so it adds ids to headers
|
||||
@@ -10,7 +10,7 @@
|
||||
// Immediately-Invoked Function Expression (IIFE) [Ben Alman Blog Post](http://benalman.com/news/2010/11/immediately-invoked-function-expression/) that calls another IIFE that contains all of the plugin logic. I used this pattern so that anyone viewing this code would not have to scroll to the bottom of the page to view the local parameters that were passed to the main IIFE.
|
||||
(function(tocify) {
|
||||
|
||||
// ECMAScript 5 Strict Mode: [John Resig Blog Post](http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/)
|
||||
// ECMAScript 5 Strict Mode: [John Resig Blog Post](https://johnresig.com/blog/ecmascript-5-strict-mode-json-and-more/)
|
||||
"use strict";
|
||||
|
||||
// Calls the second IIFE and locally passes in the global jQuery, window, and document objects
|
||||
@@ -21,7 +21,7 @@
|
||||
// Locally passes in `jQuery`, the `window` object, the `document` object, and an `undefined` variable. The `jQuery`, `window` and `document` objects are passed in locally, to improve performance, since javascript first searches for a variable match within the local variables set before searching the global variables set. All of the global variables are also passed in locally to be minifier friendly. `undefined` can be passed in locally, because it is not a reserved word in JavaScript.
|
||||
(function($, window, document, undefined) {
|
||||
|
||||
// ECMAScript 5 Strict Mode: [John Resig Blog Post](http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/)
|
||||
// ECMAScript 5 Strict Mode: [John Resig Blog Post](https://johnresig.com/blog/ecmascript-5-strict-mode-json-and-more/)
|
||||
"use strict";
|
||||
|
||||
var tocClassName = "tocify",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*! jQuery UI - v1.11.3 - 2015-02-12
|
||||
* http://jqueryui.com
|
||||
* https://jqueryui.com
|
||||
* Includes: widget.js
|
||||
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
}(function( $ ) {
|
||||
/*!
|
||||
* jQuery UI Widget 1.11.3
|
||||
* http://jqueryui.com
|
||||
* https://jqueryui.com
|
||||
*
|
||||
* Copyright jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* http://api.jqueryui.com/jQuery.widget/
|
||||
* https://api.jqueryui.com/jQuery.widget/
|
||||
*/
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
$( elem ).triggerHandler( "remove" );
|
||||
}
|
||||
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
// https://bugs.jquery.com/ticket/8235
|
||||
} catch ( e ) {}
|
||||
}
|
||||
orig( elems );
|
||||
@@ -305,7 +305,7 @@
|
||||
.unbind( this.eventNamespace )
|
||||
.removeData( this.widgetFullName )
|
||||
// support: jquery <1.6.3
|
||||
// http://bugs.jquery.com/ticket/9413
|
||||
// https://bugs.jquery.com/ticket/9413
|
||||
.removeData( $.camelCase( this.widgetFullName ) );
|
||||
this.widget()
|
||||
.unbind( this.eventNamespace )
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.7
|
||||
* lunr - https://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.7
|
||||
* Copyright (C) 2014 Oliver Nightingale
|
||||
* MIT Licensed
|
||||
* @license
|
||||
@@ -1298,12 +1298,12 @@
|
||||
/*!
|
||||
* lunr.stemmer
|
||||
* Copyright (C) 2014 Oliver Nightingale
|
||||
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
||||
* Includes code from - https://tartarus.org/~martin/PorterStemmer/js.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* lunr.stemmer is an english language stemmer, this is a JavaScript
|
||||
* implementation of the PorterStemmer taken from http://tartaurs.org/~martin
|
||||
* implementation of the PorterStemmer taken from https://tartaurs.org/~martin
|
||||
*
|
||||
* @module
|
||||
* @param {String} str The string to stem
|
||||
@@ -1689,7 +1689,7 @@
|
||||
/*!
|
||||
* lunr.stemmer
|
||||
* Copyright (C) 2014 Oliver Nightingale
|
||||
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
||||
* Includes code from - https://tartarus.org/~martin/PorterStemmer/js.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,10 +126,10 @@ public class ApiDocumentation {
|
||||
this.noteRepository.deleteAll();
|
||||
|
||||
createNote("REST maturity model",
|
||||
"http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
"https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
createNote("Hypertext Application Language (HAL)",
|
||||
"http://stateless.co/hal_specification.html");
|
||||
createNote("Application-Level Profile Semantics (ALPS)", "http://alps.io/spec/");
|
||||
"https://github.com/mikekelly/hal_specification");
|
||||
createNote("Application-Level Profile Semantics (ALPS)", "https://github.com/alps-io/spec");
|
||||
|
||||
this.mockMvc.perform(get("/notes"))
|
||||
.andExpect(status().isOk())
|
||||
@@ -153,7 +153,7 @@ public class ApiDocumentation {
|
||||
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("tags", Arrays.asList(tagLocation));
|
||||
|
||||
this.mockMvc.perform(
|
||||
@@ -181,7 +181,7 @@ public class ApiDocumentation {
|
||||
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("tags", Arrays.asList(tagLocation));
|
||||
|
||||
String noteLocation = this.mockMvc
|
||||
@@ -243,7 +243,7 @@ public class ApiDocumentation {
|
||||
public void noteUpdateExample() throws Exception {
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
|
||||
String noteLocation = this.mockMvc
|
||||
.perform(
|
||||
|
||||
@@ -77,10 +77,10 @@ include::{snippets}/error-example/http-response.adoc[]
|
||||
== Hypermedia
|
||||
|
||||
RESTful Notes uses hypermedia and resources include links to other resources in their
|
||||
responses. Responses are in http://stateless.co/hal_specification.html[Hypertext Application
|
||||
from resource to resource.
|
||||
Language (HAL)] format. Links can be found beneath the `_links` key. Users of the API should
|
||||
not create URIs themselves, instead they should use the above-described links to navigate
|
||||
responses. Responses are in https://github.com/mikekelly/hal_specification[Hypertext
|
||||
Application Language (HAL)] format. Links can be found beneath the `_links` key. Users of
|
||||
the API should not create URIs themselves, instead they should use the above-described
|
||||
links to navigate from resource to resource.
|
||||
|
||||
[[resources]]
|
||||
= Resources
|
||||
|
||||
@@ -20,7 +20,7 @@ to describe the relationships between resources and to allow navigation between
|
||||
|
||||
[getting-started-running-the-service]
|
||||
== Running the service
|
||||
RESTful Notes is written using http://projects.spring.io/spring-boot[Spring Boot] which
|
||||
RESTful Notes is written using https://projects.spring.io/spring-boot[Spring Boot] which
|
||||
makes it easy to get it up and running so that you can start exploring the REST API.
|
||||
|
||||
The first step is to clone the Git repository:
|
||||
@@ -45,7 +45,8 @@ cURL:
|
||||
include::{snippets}/index/1/curl-request.adoc[]
|
||||
|
||||
This request should yield the following response in the
|
||||
http://stateless.co/hal_specification.html[Hypertext Application Language (HAL)] format:
|
||||
https://github.com/mikekelly/hal_specification[Hypertext Application Language (HAL)]
|
||||
format:
|
||||
|
||||
include::{snippets}/index/1/http-response.adoc[]
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -124,10 +124,10 @@ public class ApiDocumentation {
|
||||
this.noteRepository.deleteAll();
|
||||
|
||||
createNote("REST maturity model",
|
||||
"http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
"https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
createNote("Hypertext Application Language (HAL)",
|
||||
"http://stateless.co/hal_specification.html");
|
||||
createNote("Application-Level Profile Semantics (ALPS)", "http://alps.io/spec/");
|
||||
"https://github.com/mikekelly/hal_specification");
|
||||
createNote("Application-Level Profile Semantics (ALPS)", "https://github.com/alps-io/spec");
|
||||
|
||||
this.mockMvc.perform(get("/notes"))
|
||||
.andExpect(status().isOk())
|
||||
@@ -154,7 +154,7 @@ public class ApiDocumentation {
|
||||
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("tags", Arrays.asList(tagLocation));
|
||||
|
||||
this.mockMvc.perform(
|
||||
@@ -182,7 +182,7 @@ public class ApiDocumentation {
|
||||
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("tags", Arrays.asList(tagLocation));
|
||||
|
||||
String noteLocation = this.mockMvc
|
||||
@@ -248,7 +248,7 @@ public class ApiDocumentation {
|
||||
public void noteUpdateExample() throws Exception {
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
|
||||
String noteLocation = this.mockMvc
|
||||
.perform(
|
||||
|
||||
@@ -84,10 +84,10 @@ include::{snippets}/error-example/http-response.adoc[]
|
||||
== Hypermedia
|
||||
|
||||
RESTful Notes uses hypermedia and resources include links to other resources in their
|
||||
responses. Responses are in http://stateless.co/hal_specification.html[Hypertext Application
|
||||
from resource to resource.
|
||||
Language (HAL)] format. Links can be found beneath the `_links` key. Users of the API should
|
||||
not create URIs themselves, instead they should use the above-described links to navigate
|
||||
responses. Responses are in https://github.com/mikekelly/hal_specification[Hypertext
|
||||
Application Language (HAL)] format. Links can be found beneath the `_links` key. Users of
|
||||
the API should not create URIs themselves, instead they should use the above-described
|
||||
links to navigate from resource to resource.
|
||||
|
||||
[[resources]]
|
||||
= Resources
|
||||
|
||||
@@ -20,7 +20,7 @@ to describe the relationships between resources and to allow navigation between
|
||||
|
||||
[getting-started-running-the-service]
|
||||
== Running the service
|
||||
RESTful Notes is written using http://projects.spring.io/spring-boot[Spring Boot] which
|
||||
RESTful Notes is written using https://projects.spring.io/spring-boot[Spring Boot] which
|
||||
makes it easy to get it up and running so that you can start exploring the REST API.
|
||||
|
||||
The first step is to clone the Git repository:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -146,9 +146,9 @@ public class ApiDocumentation {
|
||||
public void notesListExample() throws Exception {
|
||||
this.noteRepository.deleteAll();
|
||||
|
||||
createNote("REST maturity model", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
createNote("Hypertext Application Language (HAL)", "http://stateless.co/hal_specification.html");
|
||||
createNote("Application-Level Profile Semantics (ALPS)", "http://alps.io/spec/");
|
||||
createNote("REST maturity model", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
createNote("Hypertext Application Language (HAL)", "https://github.com/mikekelly/hal_specification");
|
||||
createNote("Application-Level Profile Semantics (ALPS)", "https://github.com/alps-io/spec");
|
||||
|
||||
this.mockMvc
|
||||
.perform(get("/notes"))
|
||||
@@ -172,7 +172,7 @@ public class ApiDocumentation {
|
||||
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("tags", Arrays.asList(tagLocation));
|
||||
|
||||
ConstrainedFields fields = new ConstrainedFields(NoteInput.class);
|
||||
@@ -204,7 +204,7 @@ public class ApiDocumentation {
|
||||
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("tags", Arrays.asList(tagLocation));
|
||||
|
||||
String noteLocation = this.mockMvc
|
||||
@@ -270,7 +270,7 @@ public class ApiDocumentation {
|
||||
public void noteUpdateExample() throws Exception {
|
||||
Map<String, Object> note = new HashMap<String, Object>();
|
||||
note.put("title", "REST maturity model");
|
||||
note.put("body", "http://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
note.put("body", "https://martinfowler.com/articles/richardsonMaturityModel.html");
|
||||
|
||||
String noteLocation = this.mockMvc
|
||||
.perform(post("/notes")
|
||||
|
||||
@@ -423,7 +423,7 @@ public abstract class HypermediaDocumentation {
|
||||
* {
|
||||
* "_links": {
|
||||
* "self": {
|
||||
* "href": "http://example.com/foo"
|
||||
* "href": "https://example.com/foo"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
@@ -443,7 +443,7 @@ public abstract class HypermediaDocumentation {
|
||||
* "links": [
|
||||
* {
|
||||
* "rel": "self",
|
||||
* "href": "http://example.com/foo"
|
||||
* "href": "https://example.com/foo"
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -68,7 +68,7 @@ public class LinkExtractorsPayloadTests {
|
||||
public void singleLink() throws IOException {
|
||||
Map<String, List<Link>> links = this.linkExtractor
|
||||
.extractLinks(createResponse("single-link"));
|
||||
assertLinks(Arrays.asList(new Link("alpha", "http://alpha.example.com", "Alpha")),
|
||||
assertLinks(Arrays.asList(new Link("alpha", "https://alpha.example.com", "Alpha")),
|
||||
links);
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ public class LinkExtractorsPayloadTests {
|
||||
public void multipleLinksWithDifferentRels() throws IOException {
|
||||
Map<String, List<Link>> links = this.linkExtractor
|
||||
.extractLinks(createResponse("multiple-links-different-rels"));
|
||||
assertLinks(Arrays.asList(new Link("alpha", "http://alpha.example.com", "Alpha"),
|
||||
new Link("bravo", "http://bravo.example.com")), links);
|
||||
assertLinks(Arrays.asList(new Link("alpha", "https://alpha.example.com", "Alpha"),
|
||||
new Link("bravo", "https://bravo.example.com")), links);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -85,8 +85,8 @@ public class LinkExtractorsPayloadTests {
|
||||
Map<String, List<Link>> links = this.linkExtractor
|
||||
.extractLinks(createResponse("multiple-links-same-rels"));
|
||||
assertLinks(Arrays.asList(
|
||||
new Link("alpha", "http://alpha.example.com/one", "Alpha one"),
|
||||
new Link("alpha", "http://alpha.example.com/two")), links);
|
||||
new Link("alpha", "https://alpha.example.com/one", "Alpha one"),
|
||||
new Link("alpha", "https://alpha.example.com/two")), links);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_links": {
|
||||
"alpha": "http://alpha.example.com",
|
||||
"bravo": "http://bravo.example.com"
|
||||
"alpha": "https://alpha.example.com",
|
||||
"bravo": "https://bravo.example.com"
|
||||
},
|
||||
"_embedded": "embedded-test",
|
||||
"beta": "beta-value",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_links": {
|
||||
"alpha": "http://alpha.example.com",
|
||||
"bravo": "http://bravo.example.com"
|
||||
"alpha": "https://alpha.example.com",
|
||||
"bravo": "https://bravo.example.com"
|
||||
},
|
||||
"beta": "beta-value",
|
||||
"charlie": "charlie-value"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"links": [ {
|
||||
"rel": "alpha",
|
||||
"href": "http://alpha.example.com",
|
||||
"href": "https://alpha.example.com",
|
||||
"title": "Alpha"
|
||||
}, {
|
||||
"rel": "bravo",
|
||||
"href": "http://bravo.example.com"
|
||||
"href": "https://bravo.example.com"
|
||||
} ]
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"links": [ {
|
||||
"rel": "alpha",
|
||||
"href": "http://alpha.example.com/one",
|
||||
"href": "https://alpha.example.com/one",
|
||||
"title": "Alpha one"
|
||||
}, {
|
||||
"rel": "alpha",
|
||||
"href": "http://alpha.example.com/two"
|
||||
"href": "https://alpha.example.com/two"
|
||||
} ]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"links": [ {
|
||||
"rel": "alpha",
|
||||
"href": "http://alpha.example.com",
|
||||
"href": "https://alpha.example.com",
|
||||
"title": "Alpha"
|
||||
} ]
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"links": {
|
||||
"alpha": [{
|
||||
"href": "http://alpha.example.com/one"
|
||||
"href": "https://alpha.example.com/one"
|
||||
}, {
|
||||
"href": "http://alpha.example.com/two"
|
||||
"href": "https://alpha.example.com/two"
|
||||
}]
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"_links": {
|
||||
"alpha": {
|
||||
"href": "http://alpha.example.com",
|
||||
"href": "https://alpha.example.com",
|
||||
"title": "Alpha"
|
||||
},
|
||||
"bravo": {
|
||||
"href": "http://bravo.example.com"
|
||||
"href": "https://bravo.example.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"_links": {
|
||||
"alpha": [{
|
||||
"href": "http://alpha.example.com/one",
|
||||
"href": "https://alpha.example.com/one",
|
||||
"title": "Alpha one"
|
||||
}, {
|
||||
"href": "http://alpha.example.com/two"
|
||||
"href": "https://alpha.example.com/two"
|
||||
}]
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_links": {
|
||||
"alpha": {
|
||||
"href": "http://alpha.example.com",
|
||||
"href": "https://alpha.example.com",
|
||||
"title": "Alpha"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"_links": [ {
|
||||
"rel": "alpha",
|
||||
"href": "http://alpha.example.com/one"
|
||||
"href": "https://alpha.example.com/one"
|
||||
}, {
|
||||
"rel": "alpha",
|
||||
"href": "http://alpha.example.com/two"
|
||||
"href": "https://alpha.example.com/two"
|
||||
} ]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -63,9 +63,9 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
public void requestUriHostCanBeModified() {
|
||||
this.preprocessor.host("api.example.com");
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithUri("http://api.foo.com:12345"));
|
||||
.preprocess(createRequestWithUri("https://api.foo.com:12345"));
|
||||
assertThat(processed.getUri())
|
||||
.isEqualTo(URI.create("http://api.example.com:12345"));
|
||||
.isEqualTo(URI.create("https://api.example.com:12345"));
|
||||
assertThat(processed.getHeaders().getFirst(HttpHeaders.HOST))
|
||||
.isEqualTo("api.example.com:12345");
|
||||
}
|
||||
@@ -74,9 +74,9 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
public void requestUriPortCanBeModified() {
|
||||
this.preprocessor.port(23456);
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithUri("http://api.example.com:12345"));
|
||||
.preprocess(createRequestWithUri("https://api.example.com:12345"));
|
||||
assertThat(processed.getUri())
|
||||
.isEqualTo(URI.create("http://api.example.com:23456"));
|
||||
.isEqualTo(URI.create("https://api.example.com:23456"));
|
||||
assertThat(processed.getHeaders().getFirst(HttpHeaders.HOST))
|
||||
.isEqualTo("api.example.com:23456");
|
||||
}
|
||||
@@ -85,8 +85,8 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
public void requestUriPortCanBeRemoved() {
|
||||
this.preprocessor.removePort();
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithUri("http://api.example.com:12345"));
|
||||
assertThat(processed.getUri()).isEqualTo(URI.create("http://api.example.com"));
|
||||
.preprocess(createRequestWithUri("https://api.example.com:12345"));
|
||||
assertThat(processed.getUri()).isEqualTo(URI.create("https://api.example.com"));
|
||||
assertThat(processed.getHeaders().getFirst(HttpHeaders.HOST))
|
||||
.isEqualTo("api.example.com");
|
||||
}
|
||||
@@ -95,27 +95,27 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
public void requestUriPathIsPreserved() {
|
||||
this.preprocessor.removePort();
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithUri("http://api.example.com:12345/foo/bar"));
|
||||
.preprocess(createRequestWithUri("https://api.example.com:12345/foo/bar"));
|
||||
assertThat(processed.getUri())
|
||||
.isEqualTo(URI.create("http://api.example.com/foo/bar"));
|
||||
.isEqualTo(URI.create("https://api.example.com/foo/bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestUriQueryIsPreserved() {
|
||||
this.preprocessor.removePort();
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithUri("http://api.example.com:12345?foo=bar"));
|
||||
.preprocess(createRequestWithUri("https://api.example.com:12345?foo=bar"));
|
||||
assertThat(processed.getUri())
|
||||
.isEqualTo(URI.create("http://api.example.com?foo=bar"));
|
||||
.isEqualTo(URI.create("https://api.example.com?foo=bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestUriAnchorIsPreserved() {
|
||||
this.preprocessor.removePort();
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithUri("http://api.example.com:12345#foo"));
|
||||
.preprocess(createRequestWithUri("https://api.example.com:12345#foo"));
|
||||
assertThat(processed.getUri())
|
||||
.isEqualTo(URI.create("http://api.example.com#foo"));
|
||||
.isEqualTo(URI.create("https://api.example.com#foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -133,9 +133,9 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
this.preprocessor.host("api.example.com");
|
||||
OperationRequest processed = this.preprocessor
|
||||
.preprocess(createRequestWithContent(
|
||||
"The uri 'http://localhost:12345' should be used"));
|
||||
"The uri 'https://localhost:12345' should be used"));
|
||||
assertThat(new String(processed.getContent()))
|
||||
.isEqualTo("The uri 'http://api.example.com:12345' should be used");
|
||||
.isEqualTo("The uri 'https://api.example.com:12345' should be used");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -213,9 +213,9 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
this.preprocessor.host("api.example.com");
|
||||
OperationResponse processed = this.preprocessor
|
||||
.preprocess(createResponseWithContent(
|
||||
"The uri 'http://localhost:12345' should be used"));
|
||||
"The uri 'https://localhost:12345' should be used"));
|
||||
assertThat(new String(processed.getContent()))
|
||||
.isEqualTo("The uri 'http://api.example.com:12345' should be used");
|
||||
.isEqualTo("The uri 'https://api.example.com:12345' should be used");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -281,35 +281,35 @@ public class UriModifyingOperationPreprocessorTests {
|
||||
@Test
|
||||
public void urisInRequestHeadersCanBeModified() {
|
||||
OperationRequest processed = this.preprocessor.host("api.example.com")
|
||||
.preprocess(createRequestWithHeader("Foo", "http://locahost:12345"));
|
||||
.preprocess(createRequestWithHeader("Foo", "https://locahost:12345"));
|
||||
assertThat(processed.getHeaders().getFirst("Foo"))
|
||||
.isEqualTo("http://api.example.com:12345");
|
||||
.isEqualTo("https://api.example.com:12345");
|
||||
assertThat(processed.getHeaders().getFirst("Host")).isEqualTo("api.example.com");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void urisInResponseHeadersCanBeModified() {
|
||||
OperationResponse processed = this.preprocessor.host("api.example.com")
|
||||
.preprocess(createResponseWithHeader("Foo", "http://locahost:12345"));
|
||||
.preprocess(createResponseWithHeader("Foo", "https://locahost:12345"));
|
||||
assertThat(processed.getHeaders().getFirst("Foo"))
|
||||
.isEqualTo("http://api.example.com:12345");
|
||||
.isEqualTo("https://api.example.com:12345");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void urisInRequestPartHeadersCanBeModified() {
|
||||
OperationRequest processed = this.preprocessor.host("api.example.com").preprocess(
|
||||
createRequestWithPartWithHeader("Foo", "http://locahost:12345"));
|
||||
createRequestWithPartWithHeader("Foo", "https://locahost:12345"));
|
||||
assertThat(processed.getParts().iterator().next().getHeaders().getFirst("Foo"))
|
||||
.isEqualTo("http://api.example.com:12345");
|
||||
.isEqualTo("https://api.example.com:12345");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void urisInRequestPartContentCanBeModified() {
|
||||
OperationRequest processed = this.preprocessor.host("api.example.com")
|
||||
.preprocess(createRequestWithPartWithContent(
|
||||
"The uri 'http://localhost:12345' should be used"));
|
||||
"The uri 'https://localhost:12345' should be used"));
|
||||
assertThat(new String(processed.getParts().iterator().next().getContent()))
|
||||
.isEqualTo("The uri 'http://api.example.com:12345' should be used");
|
||||
.isEqualTo("The uri 'https://api.example.com:12345' should be used");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user