GithubHelp home page GithubHelp logo

spring-projects / spring-restdocs Goto Github PK

View Code? Open in Web Editor NEW
1.1K 94.0 735.0 5.56 MB

Test-driven documentation for RESTful services

Home Page: https://spring.io/projects/spring-restdocs

License: Apache License 2.0

Java 97.32% Ruby 0.93% HTML 0.48% Vim Snippet 0.89% Dockerfile 0.01% Shell 0.34% Batchfile 0.01%

spring-restdocs's Introduction

Spring REST Docs Build status Revved up by Develocity

Overview

The primary goal of this project is to make it easy to document RESTful services by combining content that's been hand-written using Asciidoctor with auto-generated examples produced with the Spring MVC Test framework. The result is intended to be an easy-to-read user guide, akin to GitHub's API documentation for example, rather than the fully automated, dense API documentation produced by tools like Swagger.

For a broader introduction see the Documenting RESTful APIs presentation. Both the slides and a video recording are available.

Learning more

To learn more about Spring REST Docs, please consult the reference documentation.

Building from source

You will need Java 17 or later to build Spring REST Docs. It is built using Gradle:

./gradlew build

Contributing

Contributors to this project agree to uphold its code of conduct.

There are several that you can contribute to Spring REST Docs:

Third-party extensions

Name Description
restdocs-wiremock Auto-generate WireMock stubs as part of documenting your RESTful API
restdocsext-jersey Enables Spring REST Docs to be used with Jersey's test framework
spring-auto-restdocs Uses introspection and Javadoc to automatically document request and response parameters
restdocs-api-spec A Spring REST Docs extension that adds API specification support. It currently supports OpenAPI 2 and OpenAPI 3

Licence

Spring REST Docs is open source software released under the Apache 2.0 license.

spring-restdocs's People

Contributors

achimgrimm avatar ahus1 avatar andreasevers avatar bartolom avatar bric3 avatar clydebarrow avatar daniel-shuy avatar dewet22 avatar erichaagdev avatar fbenz avatar filiphr avatar izeye avatar jansturenielsen avatar jd1 avatar jlstrater avatar jprinet avatar lichking-lee avatar luontola avatar mduesterhoeft avatar meistermeier avatar mnhock avatar nertzy avatar nosan avatar openwms avatar pcvolkmer avatar spring-builds avatar spring-operator avatar tkopczynski avatar wilkinsona avatar yleguern avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-restdocs's Issues

Documentation Update

I have an update to the README file describing how to enable JSON pretty printing when operating in a Spring Boot environment but I'm usure how to proceed. Normally, I snap a branch and issue a PR but I don't appear to have the ability to create a branch from the GitHub UI. Is there a document describing the contribution process I can read?

Thanks,
Ron

RFC-6906 Profile Rel Support

We've settled on using profile link relationship to help define what's available within the resource. https://tools.ietf.org/html/rfc6906

In the client profiles map to "traits" (which in the java 7 client is interfaces, maybe 8 we'll use default methods). Client is irrelevant but it illustrates the concept really nicely that different profiles indicate what is or isn't present.

So we don't really have "resource types" we have responses that have resources that claim to implement different profiles. This allows you to know what links & fields are or are not there.

I'd like to have a ToC/Nav that lists all profiles, lets you jump around, and indicate rel X on from resource of profile y will likely return profiles a,b or c.

It's very abstract, which can be difficult for consumers to get with thought...so maybe its' better to stick to resource types and collapse profiles around them.

and obv many API's don't use the profile thing explicitly...but implicitly a type could be considered a profile based upon it's "shape", ie the links and fields that are present.

Just spitballing problems here..not even really sure what I'm looking for.

To give you an idea how profiles helps here are two Product resources...that are both products, but also very different:

{
    "name": "Premium Meal Plan",
    "description": "Select From 7 Premium Entrees To Get 14 High-Quality Meals!",
    "briefDescription": "Premium Meals, Premium Plan!",
    "violator": null,
    "rating": {
        "value": 8.25,
        "count": 4,
        "category": "Excellent"
    },
    "flags": [],
    "biToken": "prod1430160",
    "_links": {
        "profile": [
            {
                "href": "https://catalog.bodybuilding.com/profiles/product"
            },
            {
                "href": "https://catalog.bodybuilding.com/profiles/product-combo"
            },
            {
                "href": "https://catalog.bodybuilding.com/profiles/product-meal-plan"
            }
        ],
        "self": {
            "href": "http://localhost:8080/products/prod1430160"
        },
        "bb:image": [
            {
                "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1430160/image_prodprod1430160_largeImage_X_450_white.jpg",
                "name": "large"
            },
            {
                "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1430160/image_prodprod1430160_largeImage_X_130_white.jpg",
                "name": "medium"
            },
            {
                "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1430160/image_prodprod1430160_largeImage_X_70_white.jpg",
                "name": "small"
            }
        ],
        "bb:reviews": {
            "href": "http://localhost:8080/products/prod1430160/reviews{?page,size,reviewType}",
            "type": "application/json",
            "templated": true
        }
    },
    "_embedded": {
        "bb:promotions": {
            "_links": {
                "self": {
                    "href": "http://localhost:8080/products/prod1430160/promotions?page=0&size=10"
                },
                "profile": [
                    {
                        "href": "https://api.bodybuilding.com/profiles/page"
                    }
                ],
                "search": {
                    "href": "http://localhost:8080/products/prod1430160/promotions{?page,size}",
                    "templated": true
                }
            },
            "page": {
                "size": 10,
                "totalElements": 0,
                "totalPages": 0,
                "number": 0
            }
        },
        "bb:skugroups": {
            "_links": {
                "self": {
                    "href": "http://localhost:8080/products/prod1430160/skugroups?page=0&size=1"
                },
                "profile": [
                    {
                        "href": "https://api.bodybuilding.com/profiles/page"
                    }
                ],
                "search": {
                    "href": "http://localhost:8080/products/prod1430160/skugroups{?page,size}",
                    "templated": true
                }
            },
            "_embedded": {
                "item": [
                    {
                        "name": "",
                        "violator": {
                            "text": "free shipping",
                            "color": "vio-red"
                        },
                        "listPriceDisplay": "$111.48",
                        "salePriceDisplay": "$111.48",
                        "listPrice": 111.48,
                        "salePrice": 111.48,
                        "flags": [],
                        "_links": {
                            "profile": [
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup"
                                },
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup-combo"
                                },
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup-meal-plan"
                                }
                            ],
                            "bb:image": [
                                {
                                    "href": "/images/store/skuimage/sku_BBFUEL1450168/image_skuBBFUEL1450168_largeImage_X_450_white.jpg",
                                    "name": "large"
                                },
                                {
                                    "href": "/images/store/skuimage/sku_BBFUEL1450168/image_skuBBFUEL1450168_largeImage_X_130_white.jpg",
                                    "name": "medium"
                                },
                                {
                                    "href": "/images/store/skuimage/sku_BBFUEL1450168/image_skuBBFUEL1450168_largeImage_X_70_white.jpg",
                                    "name": "small"
                                }
                            ],
                            "self": {
                                "href": "http://localhost:8080/skugroups/prod1430160_BBFUEL1450168"
                            },
                            "bb:product": {
                                "href": "http://localhost:8080/products/prod1430160"
                            }
                        },
                        "_embedded": {
                            "bb:skus": {
                                "_links": {
                                    "self": {
                                        "href": "http://localhost:8080/skugroups/prod1430160_BBFUEL1450168/skus?page=0&size=1"
                                    },
                                    "profile": [
                                        {
                                            "href": "https://api.bodybuilding.com/profiles/page"
                                        }
                                    ],
                                    "search": {
                                        "href": "http://localhost:8080/skugroups/prod1430160_BBFUEL1450168/skus{?page,size}",
                                        "templated": true
                                    }
                                },
                                "_embedded": {
                                    "item": [
                                        {
                                            "name": null,
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "BBFUEL1450168",
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-combo"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-meal-plan"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://localhost:8080/skus/BBFUEL1450168"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1450168/image_skuBBFUEL1450168_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1450168/image_skuBBFUEL1450168_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1450168/image_skuBBFUEL1450168_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://localhost:8080/skugroups/prod1430160_BBFUEL1450168"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://www.bodybuilding.com/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=BBFUEL1450168&productId=prod1430160{&CSRF}",
                                                    "templated": true
                                                }
                                            },
                                            "_embedded": {
                                                "bb:choice": [
                                                    {
                                                        "name": "Select Premium Meal  #1",
                                                        "quantity": 14,
                                                        "_links": {
                                                            "profile": [
                                                                {
                                                                    "href": "https://catalog.bodybuilding.com/profiles/choice"
                                                                },
                                                                {
                                                                    "href": "https://catalog.bodybuilding.com/profiles/choice-multi"
                                                                }
                                                            ],
                                                            "self": {
                                                                "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004"
                                                            },
                                                            "bb:image": [
                                                                {
                                                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390310/image_skuBBFUEL1390310_largeImage_X_70_white.jpg",
                                                                    "name": "small"
                                                                }
                                                            ],
                                                            "bb:select-update": {
                                                                "href": "http://localhost:8080/skus//selectUpdate{?options*}"
                                                            }
                                                        },
                                                        "_embedded": {
                                                            "bb:option": [
                                                                {
                                                                    "name": "Chicken Breast, Brown Rice & Broccoli",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1390310",
                                                                    "gramsProtein": 39,
                                                                    "gramsCarbs": 33,
                                                                    "gramsFat": 8,
                                                                    "calories": 370,
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            },
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku-meal"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1390310"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390310/image_skuBBFUEL1390310_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390310/image_skuBBFUEL1390310_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390310/image_skuBBFUEL1390310_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1390310/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    "name": "Tilapia & Broccoli",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1390326",
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1390326"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390326/image_skuBBFUEL1390326_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390326/image_skuBBFUEL1390326_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390326/image_skuBBFUEL1390326_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1390326/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    "name": "Egg White Omelet with Chicken & Oatmeal",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1470124",
                                                                    "gramsProtein": 42,
                                                                    "gramsCarbs": 27,
                                                                    "gramsFat": 9,
                                                                    "calories": 350,
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            },
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku-meal"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1470124"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1470124/image_skuBBFUEL1470124_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1470124/image_skuBBFUEL1470124_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1470124/image_skuBBFUEL1470124_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1470124/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    "name": "Egg White Omelet with Chicken & Vegetables",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1470120",
                                                                    "gramsProtein": 37,
                                                                    "gramsCarbs": 7,
                                                                    "gramsFat": 8,
                                                                    "calories": 260,
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            },
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku-meal"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1470120"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1470120/image_skuBBFUEL1470120_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1470120/image_skuBBFUEL1470120_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1470120/image_skuBBFUEL1470120_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1470120/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    "name": "Tilapia, Sweet Potato & Asparagus",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1390328",
                                                                    "gramsProtein": 39,
                                                                    "gramsCarbs": 30,
                                                                    "gramsFat": 3,
                                                                    "calories": 300,
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            },
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku-meal"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1390328"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390328/image_skuBBFUEL1390328_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390328/image_skuBBFUEL1390328_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390328/image_skuBBFUEL1390328_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1390328/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    "name": "Chicken Breast, Sweet Potato & Green Beans",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1390308",
                                                                    "gramsProtein": 37,
                                                                    "gramsCarbs": 33,
                                                                    "gramsFat": 10,
                                                                    "calories": 370,
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            },
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku-meal"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1390308"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390308/image_skuBBFUEL1390308_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390308/image_skuBBFUEL1390308_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390308/image_skuBBFUEL1390308_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1390308/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                },
                                                                {
                                                                    "name": "Chicken Breast & Asparagus",
                                                                    "inventory": {
                                                                        "status": "IN_STOCK",
                                                                        "label": "In Stock",
                                                                        "message": null
                                                                    },
                                                                    "biToken": "BBFUEL1390312",
                                                                    "gramsProtein": 37,
                                                                    "gramsCarbs": 7,
                                                                    "gramsFat": 10,
                                                                    "calories": 260,
                                                                    "_links": {
                                                                        "profile": [
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                                            },
                                                                            {
                                                                                "href": "https://catalog.bodybuilding.com/profiles/sku-meal"
                                                                            }
                                                                        ],
                                                                        "self": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1450168/choices/cp660004/options/BBFUEL1390312"
                                                                        },
                                                                        "bb:image": [
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390312/image_skuBBFUEL1390312_largeImage_X_450_white.jpg",
                                                                                "name": "large"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390312/image_skuBBFUEL1390312_largeImage_X_130_white.jpg",
                                                                                "name": "medium"
                                                                            },
                                                                            {
                                                                                "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_BBFUEL1390312/image_skuBBFUEL1390312_largeImage_X_70_white.jpg",
                                                                                "name": "small"
                                                                            }
                                                                        ],
                                                                        "bb:ingredient-label": {
                                                                            "href": "http://localhost:8080/skus/BBFUEL1390312/ingredientLabel",
                                                                            "type": "text/html"
                                                                        }
                                                                    }
                                                                }
                                                            ],
                                                            "bb:brand": {
                                                                "label": "B-Elite Fuel",
                                                                "description": "You Are Elite. This Is Your Fuel.",
                                                                "_links": {
                                                                    "profile": [
                                                                        {
                                                                            "href": "https://catalog.bodybuilding.com/profiles/category"
                                                                        }
                                                                    ],
                                                                    "self": {
                                                                        "href": "http://localhost:8080/category/cat830006"
                                                                    },
                                                                    "bb:full": {
                                                                        "href": "http://localhost:8080/category/cat830006"
                                                                    },
                                                                    "bb:image": [
                                                                        {
                                                                            "href": "http://store.bbcomcdn.com/store/deploy/images/category/cat_cat830006/image_catcat830006_largeImage.png",
                                                                            "name": "icon"
                                                                        }
                                                                    ]
                                                                }
                                                            }
                                                        }
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                },
                                "page": {
                                    "size": 1,
                                    "totalElements": 1,
                                    "totalPages": 1,
                                    "number": 0
                                }
                            }
                        }
                    }
                ]
            },
            "page": {
                "size": 1,
                "totalElements": 1,
                "totalPages": 1,
                "number": 0
            }
        },
        "bb:brand": {
            "label": "B-Elite Fuel",
            "description": "You Are Elite. This Is Your Fuel.",
            "_links": {
                "profile": [
                    {
                        "href": "https://catalog.bodybuilding.com/profiles/category"
                    }
                ],
                "self": {
                    "href": "http://localhost:8080/category/cat830006"
                },
                "bb:full": {
                    "href": "http://localhost:8080/category/cat830006"
                },
                "bb:image": [
                    {
                        "href": "http://store.bbcomcdn.com/store/deploy/images/category/cat_cat830006/image_catcat830006_largeImage.png",
                        "name": "icon"
                    }
                ]
            }
        }
    }
}

and

{
    "name": "Phase8",
    "description": "Sustained Release Protein with Amino Acids for Longer Muscle Building Benefits*",
    "briefDescription": "Muscle Building Protein Powder Blend*",
    "violator": null,
    "rating": {
        "value": 9.1,
        "count": 2491,
        "category": "Excellent"
    },
    "flags": [],
    "biToken": "prod1280062",
    "_links": {
        "profile": [
            {
                "href": "https://catalog.bodybuilding.com/profiles/product"
            },
            {
                "href": "https://catalog.bodybuilding.com/profiles/product-supplement"
            }
        ],
        "self": {
            "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062"
        },
        "bb:image": [
            {
                "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_450_white.jpg",
                "name": "large"
            },
            {
                "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_130_white.jpg",
                "name": "medium"
            },
            {
                "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_70_white.jpg",
                "name": "small"
            }
        ],
        "bb:reviews": {
            "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062/reviews{?page,size,reviewType}",
            "type": "application/json",
            "templated": true
        },
        "bb:ingredient-labels": {
            "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062/ingredientLabels"
        }
    },
    "_embedded": {
        "bb:promotions": {
            "_links": {
                "self": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062/promotions?page=0&size=10"
                },
                "profile": [
                    {
                        "href": "https://api.bodybuilding.com/profiles/page"
                    }
                ],
                "search": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062/promotions{?page,size}",
                    "templated": true
                }
            },
            "_embedded": {
                "item": [
                    {
                        "title": "Stacked Savings!",
                        "content": "Get additional savings when you purchase <strong><a href=\"http://www.bodybuilding.com/store/muscletech/core-stack.html\">Core Stack</a></strong>",
                        "badges": null,
                        "disclaimer": null,
                        "_links": {
                            "profile": [
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/promotion"
                                }
                            ],
                            "self": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/promotions/promo1580015"
                            },
                            "bb:image-primary": [
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1390076/image_prodprod1390076_largeImage_X_450_white.jpg",
                                    "name": "large"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1390076/image_prodprod1390076_largeImage_X_130_white.jpg",
                                    "name": "small"
                                }
                            ],
                            "bb:image-secondary": [
                                {
                                    "href": "http://store.bbcomcdn.com/store/deploy/images/common/no_image/noimage-w450.png",
                                    "name": "large"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/store/deploy/images/common/no_image/noimage-w130.png",
                                    "name": "small"
                                }
                            ],
                            "bb:promotion-target": [
                                {
                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/BRAND_BIGNUTRITION",
                                    "name": "primary",
                                    "profile": "https://catalog.bodybuilding.com/profiles/category"
                                }
                            ]
                        }
                    }
                ]
            },
            "page": {
                "size": 10,
                "totalElements": 1,
                "totalPages": 1,
                "number": 0
            }
        },
        "bb:main-ingredient": {
            "label": "Whey Protein",
            "description": "Whey protein is a fast-absorbing source of protein to support lean muscle! Great for anytime of the day - especially post-workout! ",
            "_links": {
                "profile": [
                    {
                        "href": "https://catalog.bodybuilding.com/profiles/category"
                    }
                ],
                "self": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/INGREDIENT_WHEY_PROTEIN"
                },
                "bb:full": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/INGREDIENT_WHEY_PROTEIN"
                },
                "bb:image-menu": [
                    {
                        "href": "http://store.bbcomcdn.com/store/deploy/images/category/sub_and_featured/protein/whey_protein_featured.jpg",
                        "name": "medium"
                    }
                ]
            }
        },
        "bb:skugroups": {
            "_links": {
                "self": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062/skugroups?page=0&size=3"
                },
                "profile": [
                    {
                        "href": "https://api.bodybuilding.com/profiles/page"
                    }
                ],
                "search": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062/skugroups{?page,size}",
                    "templated": true
                }
            },
            "_embedded": {
                "item": [
                    {
                        "name": "2 Lbs.",
                        "violator": {
                            "text": null,
                            "color": null
                        },
                        "listPriceDisplay": "$44.99",
                        "salePriceDisplay": "$27.97",
                        "listPrice": 44.99,
                        "salePrice": 27.97,
                        "flags": [],
                        "size": "2 Lbs.",
                        "servings": 22,
                        "pricePerServing": 1.2713636363636363,
                        "_links": {
                            "profile": [
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup"
                                },
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup-supplement"
                                }
                            ],
                            "bb:image": [
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450152/image_skuMT1450152_largeImage_X_450_white.jpg",
                                    "name": "large"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450152/image_skuMT1450152_largeImage_X_130_white.jpg",
                                    "name": "medium"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450152/image_skuMT1450152_largeImage_X_70_white.jpg",
                                    "name": "small"
                                }
                            ],
                            "self": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                            },
                            "bb:product": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062"
                            }
                        },
                        "_embedded": {
                            "bb:skus": {
                                "_links": {
                                    "self": {
                                        "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374/skus?page=0&size=6"
                                    },
                                    "profile": [
                                        {
                                            "href": "https://api.bodybuilding.com/profiles/page"
                                        }
                                    ],
                                    "search": {
                                        "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374/skus{?page,size}",
                                        "templated": true
                                    }
                                },
                                "_embedded": {
                                    "item": [
                                        {
                                            "name": "Cookies and Cream",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1530374",
                                            "flavor": "Cookies and Cream",
                                            "flavorRating": 8.53,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1530374"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1530374/image_skuMT1530374_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1530374/image_skuMT1530374_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1530374/image_skuMT1530374_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1530374/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1530374&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1530374&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Milk Chocolate",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1450152",
                                            "flavor": "Milk Chocolate",
                                            "flavorRating": 8.91,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1450152"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450152/image_skuMT1450152_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450152/image_skuMT1450152_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450152/image_skuMT1450152_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1450152/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1450152&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1450152&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Peanut Butter Chocolate - Exclusive! ",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1640032",
                                            "flavor": "Peanut Butter Chocolate - Exclusive! ",
                                            "flavorRating": 9.48,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1640032"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1640032/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1640032&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1640032&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Strawberry",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1450154",
                                            "flavor": "Strawberry",
                                            "flavorRating": 8.86,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1450154"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450154/image_skuMT1450154_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450154/image_skuMT1450154_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450154/image_skuMT1450154_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1450154/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1450154&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1450154&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Vanilla",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1450156",
                                            "flavor": "Vanilla",
                                            "flavorRating": 9.04,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1450156"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450156/image_skuMT1450156_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450156/image_skuMT1450156_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1450156/image_skuMT1450156_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1450156/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1450156&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1450156&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "White Chocolate",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1840012",
                                            "flavor": "White Chocolate",
                                            "flavorRating": 8.55,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1840012"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1840012/image_skuMT1840012_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1840012/image_skuMT1840012_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1840012/image_skuMT1840012_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530374"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1840012/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1840012&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1840012&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        }
                                    ]
                                },
                                "page": {
                                    "size": 6,
                                    "totalElements": 6,
                                    "totalPages": 1,
                                    "number": 0
                                }
                            }
                        }
                    },
                    {
                        "name": "4 Servings",
                        "violator": {
                            "text": null,
                            "color": null
                        },
                        "listPriceDisplay": "$13.99",
                        "salePriceDisplay": "$9.99",
                        "listPrice": 13.99,
                        "salePrice": 9.99,
                        "flags": [],
                        "size": "4 Servings",
                        "servings": 4,
                        "pricePerServing": 2.4975,
                        "_links": {
                            "profile": [
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup"
                                },
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup-supplement"
                                }
                            ],
                            "bb:image": [
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760033/image_skuMT1760033_largeImage_X_450_white.jpg",
                                    "name": "large"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760033/image_skuMT1760033_largeImage_X_130_white.jpg",
                                    "name": "medium"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760033/image_skuMT1760033_largeImage_X_70_white.jpg",
                                    "name": "small"
                                }
                            ],
                            "self": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035"
                            },
                            "bb:product": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062"
                            }
                        },
                        "_embedded": {
                            "bb:skus": {
                                "_links": {
                                    "self": {
                                        "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035/skus?page=0&size=5"
                                    },
                                    "profile": [
                                        {
                                            "href": "https://api.bodybuilding.com/profiles/page"
                                        }
                                    ],
                                    "search": {
                                        "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035/skus{?page,size}",
                                        "templated": true
                                    }
                                },
                                "_embedded": {
                                    "item": [
                                        {
                                            "name": "Cookies and Cream",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1760035",
                                            "flavor": "Cookies and Cream",
                                            "flavorRating": 8.53,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760035"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760035/image_skuMT1760035_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760035/image_skuMT1760035_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760035/image_skuMT1760035_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760035/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1760035&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1760035&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Milk Chocolate",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1760031",
                                            "flavor": "Milk Chocolate",
                                            "flavorRating": 8.91,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760031"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760031/image_skuMT1760031_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760031/image_skuMT1760031_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760031/image_skuMT1760031_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760031/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1760031&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1760031&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Peanut Butter Chocolate",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1760033",
                                            "flavor": "Peanut Butter Chocolate",
                                            "flavorRating": 8.36,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760033"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760033/image_skuMT1760033_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760033/image_skuMT1760033_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760033/image_skuMT1760033_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760033/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1760033&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1760033&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Strawberry",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1950166",
                                            "flavor": "Strawberry",
                                            "flavorRating": 8.86,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1950166"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/prodimage/prod_prod1280062/image_prodprod1280062_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1950166/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1950166&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1950166&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Vanilla",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1760108",
                                            "flavor": "Vanilla",
                                            "flavorRating": 9.04,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760108"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760108/image_skuMT1760108_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760108/image_skuMT1760108_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1760108/image_skuMT1760108_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1760035"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1760108/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1760108&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1760108&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        }
                                    ]
                                },
                                "page": {
                                    "size": 5,
                                    "totalElements": 5,
                                    "totalPages": 1,
                                    "number": 0
                                }
                            }
                        }
                    },
                    {
                        "name": "4.4 Lbs.",
                        "violator": {
                            "text": null,
                            "color": null
                        },
                        "listPriceDisplay": "$82.99",
                        "salePriceDisplay": "$46.97",
                        "listPrice": 82.99,
                        "salePrice": 46.97,
                        "flags": [],
                        "size": "4.4 Lbs.",
                        "servings": 50,
                        "pricePerServing": 0.9394,
                        "_links": {
                            "profile": [
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup"
                                },
                                {
                                    "href": "https://catalog.bodybuilding.com/profiles/skugroup-supplement"
                                }
                            ],
                            "bb:image": [
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490004/image_skuMT1490004_largeImage_X_450_white.jpg",
                                    "name": "large"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490004/image_skuMT1490004_largeImage_X_130_white.jpg",
                                    "name": "medium"
                                },
                                {
                                    "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490004/image_skuMT1490004_largeImage_X_70_white.jpg",
                                    "name": "small"
                                }
                            ],
                            "self": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372"
                            },
                            "bb:product": {
                                "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/products/prod1280062"
                            }
                        },
                        "_embedded": {
                            "bb:skus": {
                                "_links": {
                                    "self": {
                                        "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372/skus?page=0&size=5"
                                    },
                                    "profile": [
                                        {
                                            "href": "https://api.bodybuilding.com/profiles/page"
                                        }
                                    ],
                                    "search": {
                                        "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372/skus{?page,size}",
                                        "templated": true
                                    }
                                },
                                "_embedded": {
                                    "item": [
                                        {
                                            "name": "Cookies and Cream",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1530372",
                                            "flavor": "Cookies and Cream",
                                            "flavorRating": 8.53,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1530372"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1530372/image_skuMT1530372_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1530372/image_skuMT1530372_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1530372/image_skuMT1530372_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1530372/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1530372&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1530372&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Milk Chocolate",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1490004",
                                            "flavor": "Milk Chocolate",
                                            "flavorRating": 8.91,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1490004"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490004/image_skuMT1490004_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490004/image_skuMT1490004_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490004/image_skuMT1490004_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1490004/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1490004&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1490004&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Strawberry",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1490008",
                                            "flavor": "Strawberry",
                                            "flavorRating": 8.86,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1490008"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490008/image_skuMT1490008_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490008/image_skuMT1490008_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490008/image_skuMT1490008_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1490008/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1490008&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1490008&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "Vanilla",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1490006",
                                            "flavor": "Vanilla",
                                            "flavorRating": 9.04,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1490006"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490006/image_skuMT1490006_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490006/image_skuMT1490006_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1490006/image_skuMT1490006_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1490006/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1490006&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1490006&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        },
                                        {
                                            "name": "White Chocolate",
                                            "inventory": {
                                                "status": "IN_STOCK",
                                                "label": "In Stock",
                                                "message": null
                                            },
                                            "biToken": "MT1850002",
                                            "flavor": "White Chocolate",
                                            "flavorRating": 8.55,
                                            "_links": {
                                                "profile": [
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku"
                                                    },
                                                    {
                                                        "href": "https://catalog.bodybuilding.com/profiles/sku-supplement"
                                                    }
                                                ],
                                                "self": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1850002"
                                                },
                                                "bb:image": [
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1850002/image_skuMT1850002_largeImage_X_450_white.jpg",
                                                        "name": "large"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1850002/image_skuMT1850002_largeImage_X_130_white.jpg",
                                                        "name": "medium"
                                                    },
                                                    {
                                                        "href": "http://store.bbcomcdn.com/images/store/skuimage/sku_MT1850002/image_skuMT1850002_largeImage_X_70_white.jpg",
                                                        "name": "small"
                                                    }
                                                ],
                                                "bb:skugroup": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skugroups/prod1280062_MT1530372"
                                                },
                                                "bb:ingredient-label": {
                                                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/skus/MT1850002/ingredientLabel",
                                                    "type": "text/html"
                                                },
                                                "bb:add-to-wishlist": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/bodybuilding/commerce/wishlist/WishlistActor/addItemToWishList?skuId=MT1850002&productId=prod1280062{&CSRF}",
                                                    "templated": true
                                                },
                                                "bb:add-to-cart": {
                                                    "href": "http://bitwise-int1.dev:8080/rest/model/atg/commerce/order/purchase/CartModifierActor/addItemToOrder?skuId=MT1850002&productId=prod1280062{&quantity,CSRF}",
                                                    "templated": true
                                                }
                                            }
                                        }
                                    ]
                                },
                                "page": {
                                    "size": 5,
                                    "totalElements": 5,
                                    "totalPages": 1,
                                    "number": 0
                                }
                            }
                        }
                    }
                ]
            },
            "page": {
                "size": 3,
                "totalElements": 3,
                "totalPages": 1,
                "number": 0
            }
        },
        "bb:main-goal": {
            "label": "Build Muscle",
            "description": "Looking to build a strong, lean and muscular body? Check out the top muscle building supplements and start seeing results! ",
            "_links": {
                "profile": [
                    {
                        "href": "https://catalog.bodybuilding.com/profiles/category"
                    }
                ],
                "self": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/BUILD_MUSCLE"
                },
                "bb:full": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/BUILD_MUSCLE"
                },
                "bb:image-menu": [
                    {
                        "href": "http://store.bbcomcdn.com/store/deploy/images/category/sub_and_featured/build_muscle/build_muscle_featured2.jpg",
                        "name": "medium"
                    }
                ]
            }
        },
        "bb:brand": {
            "label": "MuscleTech",
            "description": "MuscleTech has created a line of great products at great prices. Tons of people are using them everyday with great results... are you next?",
            "_links": {
                "profile": [
                    {
                        "href": "https://catalog.bodybuilding.com/profiles/category"
                    }
                ],
                "self": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/BRAND_MUSCLETECH"
                },
                "bb:full": {
                    "href": "http://bitwise-api1.dev:8080/commerce-hyper-api/category/BRAND_MUSCLETECH"
                },
                "bb:image": [
                    {
                        "href": "http://store.bbcomcdn.com/store/deploy/images/category/sub_and_featured/brand_images/muscletech-featured.png",
                        "name": "icon"
                    }
                ]
            }
        }
    }
}

Consider request parameters when determining a GET request's query string

I have a documentation test like the following:

@Test
public void testSearchingRoutes() throws Exception {
    mockMvc.perform(get("/routes").param("startNear", "+42.297877,-71.485591").param("endNear", "+41.949915,-71.406392"))
        .andExpect(status().isOk())
        .andDo(document("search-routes-example"));
}

When I run this as part of my Maven build, a request-response.asciidoc is produced, but the sample curl request omits the query parameters.

Putting a breakpoint in the RoutesController shows me that the parameters are indeed received by the controller, so I believe I'm sending them correctly with MockMvc.

Any reason I would get a curl snippet like:
[source,bash]
----
$ curl http://localhost:8080/routes -i
----
for this request?

Compile Error

I get this error when trying to compile the samples.
You probably forgot to check something into github
Happens with maven and gradle.

[ERROR] /home/tsweets/projects/spring-restdocs/rest-notes-spring-data-rest/src/test/java/com/example/notes/ApiDocumentation.java:[98,81] incompatible types: org.springframework.restdocs.core.LinkDescriptor cannot be converted to org.springframework.restdocs.core.LinkExtractor

Environment
Arch Linux
Oracle Java 1.8

json response is empty for an error in the generated snippets

Hi
I just started "playing" with spring-restdocs and really love it.
I have a small springboot project with one @RestController.
So far, I have integrated spring-restdocs successfully to document a successful GET and POST.
But I have an incomplete result when I try do document the GET producing an error.

I have defined a particular ex to produce a NOT_FOUND response:

@ResponseStatus(value = NOT_FOUND)   
class NoEmailFoundException extends RuntimeException{

Then the GET method of my controller throws that exception:

@RequestMapping(value="/status/{id}", method = GET)
public EmailStatus getEmailStatus(
            @PathVariable(value = "id") final String id) throws Exception {

       Email email =  findEmail(id);

        if(email == null){
            throw new NoEmailFoundException("Could not find email with ID '" + id + "'.");
        }
...

When I call this resource from the live application, I get the following response:

HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Sun, 22 Feb 2015 22:33:21 GMT

{
  "timestamp" : 1424644401861,
  "status" : 404,
  "error" : "Not Found",
  "exception" : "com....NoEmailFoundException",
  "message" : "Could not find email with ID '123'.",
  "path" : "/email/outbound/status/123"
}⏎ 

Which is perfect.

Then I tried to generate the response snippet for this situation.
I took inspiration from the sample: com.example.notes.ApiDocumentation#errorExample

@Test
public void errorEmailNotFound() throws Exception {
        this.mockMvc.perform(get("/email/outbound/status/123").accept(APPLICATION_JSON))
                .andDo(print())
                .andDo(document("error-email-notfound-example"));
    }

The test pass, but the generated snippet does not contain the json response that I get on the live environment:

[source,http]
----
HTTP/1.1 404 Not Found


----

Am I missing something?
Thanks for your help and for this project.

Add support for documenting fields in JSON array payloads

I'm getting the following exception when using withResponseFields on a response which is a JSON array. The test which reproduces this can be seen in ApiDocumentation.java and the controller method called by it is in FacilityController.java.

com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.LinkedHashMap out of START_ARRAY token
 at [Source: java.io.StringReader@4a520f05; line: 1, column: 1]
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:762)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:758)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:325)
    at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:26)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3066)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2184)
    at org.springframework.restdocs.payload.FieldValidator.validate(FieldValidator.java:46)
    at org.springframework.restdocs.payload.FieldSnippetResultHandler.handle(FieldSnippetResultHandler.java:69)
    at org.springframework.restdocs.snippet.SnippetWritingResultHandler.handle(SnippetWritingResultHandler.java:51)
    at org.springframework.restdocs.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:159)
    at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:158)
    at fi.hsl.parkandride.docs.ApiDocumentation.utilizationExample(ApiDocumentation.java:324)

Provide support for documenting required and optional elements in requests and responses

The samples currently use manually written tables to document the structure of requests and responses. This is error prone as there's nothing to verify the contents of the table against the service. We should provide an API, possibly similar to the one used for links, that produces the table and verifies its contents against the service that's being documented.

Bean Validation API support

I understand that this project was partially created out of the authors frustration with tools like Swagger and annotation processing. I also like the test-driven approach to producing documentation.

I'd like to propose an enhancement to allow for a limited amount of annotation processing. Specifically, for the Bean Validation API and Hibernate Validator annotations.

When documenting an API using the "test-driven" approach I think it's potentially tricky to try and document what the request body should look like and what the constraints on each field are.

One can, and should, write tests that verify that the app does reject invalid values for each field, e.g. invalid email format, missing required fields, too long/short data etc... It would also be a good idea to test an example of a "good" request (and therefore automatically have it documented). However, when producing documentation, showing people all the possible ways a request could be wrong doesn't sound like the best way. It would be nicer to show an example of a "good" request and then explain what the basic validation rules are (clearly there will often be validation which isn't expressed using the bean validation API and these may warrant explicit hand written documentation).

The problem with writing this sort of information into the asciidoc file directly, is that as soon as any validation rules change the docs are immediately out-of-date (DRY/SSOT). This seems a shame given that often a lot of the basic rules are easily expressed declaratively with the bean validation annotations.

I don't necessarily know what the "best" way of doing this would be. But to prevent having to discover which Objects need to be parsed the feature could require the documentation code to pass the class object (TestRequest.class in the example below) to some kind of processor in spring-restdoc. It could produce an asciidoc file in the snippets output directory that contained a table describing the rules.

Example

Controller Method

    @RequestMapping(value = ... , method = ..., consumes = ...)
    public ResponseEntity<TestResult> test(@RequestBody TestRequest requestBody) {
        ...
    }

Request Body

public class TestRequest {
    @NotBlank
    @Length(min = 1, max = 2_000)
    private String field1;

    @Email
    @NotBlank
    @Length(max = 254)
    private String field2;

    @Length(min = 5, max = 20)
    private String field3;

    @NotNull
    private Boolean field4;

   // constructors, getters, setters etc...
}

Sample Output

|===
|Field  |Mandatory |Validation Rules

|field1
|Yes
|Length 1 - 2,000

|field2
|Yes
|Valid email format, max length 254

|field3
|No
|Length 5 - 20

|field4
|Yes
|true/false
|===

Such a snippet could then be included in the documentation as usual include::{generated}/request-body.asciidoc[]

I don't suggest processing the controller to try and "auto-discover" the correct endpoint, supported media types, HTTP methods, response codes or which objects form the request body and so on.

Allow specifying prefix URI to be included in curl for loadbalancers

Our curl url looks something like this
$ curl https://mycloud/router/users
The controller code only maps "/users" because the router is external to the service.

I am looking for rest documentation configurer to support a "withPrefixUri" command like the following so that the curl commands are actually valid.
new RestDocumentationConfigurer().withScheme("https").withHost("mycloud")
.withPort(443).withPrefixUri("/router")

p.s. ingenious idea to let the tests drive the documentation. Developers can now write tests & documentation first before implementation - Test & Doc Driven Development. (TDDD)

Customization of Request and Response columns

Right now we can have only three columned table for request and response fields, but what if we need to add an additional column for some requests or responses or rename an existing columns?

_Suggestion 1_
To add a factory for column fields like so

.andDo(document("assets/banks").response().withFields(
    fieldWithPath("id").description("UUID of the asset."),
    fieldWithPath("name").description("Name of the asset.")
)

And if we need to add _size_ column to response table:

.andDo(document("assets/banks").response(withColumn("size")).withFields(
    fieldWithPath("id").description("UUID of the asset.").column("size", "0..12"),
    fieldWithPath("name").description("Name of the asset.").column("size", "15..20")
)

Also if we need to rename default column _description_ into _info_:

.andDo(document("assets/banks").response(
    withDescriptionAs("info"),
    withColumn("size")
).withFields(
    fieldWithPath("id").description("UUID of the asset.").column("size", "0..12"),
    fieldWithPath("name").description("Name of the asset.").column("size", "15..20")
)

_Suggestion 2_
To create a _ColumnDescriptor_ class so we can extend columns more flexible.

.andDo(document("assets/banks").withResponseFields(
    fieldWithPath("id").with(description("UUID of the asset."), size(0, 23))
)

Then in case of renaming a default field you'll have to extend it and rename it.

P.S.
There is also an open question around the order of columns.

Add support for documenting JSON payloads containing arrays

I'm trying to extract response fields (table) for a relatively complex JSON structure which contains array of objects. It is possible to add top level paths with fieldWithPath method, but is there a way to add a array of objects and their paths to the response fields in a way similar to following?

Sample JSON

{
        "id": 67,
        "name": "2015-01-20",
        "assets": [
          {
            "id":356,
            "name": "sample"
          }
        ]
}

Response structure

Path Type Description
id Number Unique,system generated ID
name String Unique name
asset[].id Number System generated ID for asset
asset[].name String Asset name

Support Self-Hosted API Documentation In Spring Boot Applications

I'm using Spring Boot 1.2.1, Spring REST Docs 0.1.0.BUILD-SNAPSHOT and Gradle 2.2.1. I love what docs gives us but I was disappointed to see that due to the task ordering of the build, I wasn't easily able to embed the API docs into my application and make them self-hosted. I've worked around the issue by updating the JAR after asciidoc is run but I'm hoping we can come up with a more elegant solution. Perhaps we can work with someone on the Boot team and figure out a lifecycle that allow for self-hosting?

Here is my solution, if anybody finds that interesting.

asciidoctor {
    attributes 'generated': generatedDocumentation
    inputs.dir generatedDocumentation
    dependsOn integrationTests
}

task copyApiDocs( type: Copy, dependsOn: asciidoctor ) {
    from "${buildDir}/asciidoc/html5"
    into "${buildDir}/api-docs/static/api-docs/"
}

task updateJarWithApiDocumentation( dependsOn: copyApiDocs ) {
    doLast {
        ant.jar( update: 'true',
                 duplicate: 'fail',
                 compress: 'false',
                 destfile: "${libsDir}/${archivesBaseName}-${version}.jar") {
            fileset( dir: "${buildDir}/api-docs" )
        }
    }
}

Jackson end-of-input exception when trying to document using withRequestFields

We are trying to use the new RestDocumentationResultHandler.withRequestFields functionality to document our query string parameters, however I am getting the following exception when running the unit test:

com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: UNKNOWN; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3110)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2184)
at org.springframework.restdocs.payload.FieldValidator.validate(FieldValidator.java:45)
at org.springframework.restdocs.payload.FieldSnippetResultHandler.handle(FieldSnippetResultHandler.java:72)
at org.springframework.restdocs.snippet.SnippetWritingResultHandler.handle(SnippetWritingResultHandler.java:51)
at org.springframework.restdocs.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:63)
at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:158)
at ..*.api.controllers.landobservations.LandObservationsControllerTest.test 1 resource(LandObservationsControllerTest.groovy:219)

We already use RestDocumentationResultHandler.withLinks in the same tests, with no issues. I have tried running only the withRequestFields documentor, but get the same result.

I wonder if there is some additional config (perhaps in our jackson ObjectMapper) we need, or if this may be a bug in the new code.. I shall continue to investigate and debug and will update if/when I know more; incidentally the new RestDocumentationResultHandler.withResponseFields functionality does not seem to have the same issue, although we have not fully implemented that yet.

Thanks

Fallback handler for legacy configured SD Rest projects

Hi,
in some cases Client projects running with earlier versions of SD Rest do not run on the HAL spec. Others and newer projects might be configured as follows:

@Override
    protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
        ...
        config.setDefaultMediaType(MediaType.APPLICATION_JSON);
        config.useHalAsDefaultJsonMediaType(false);
    }

For those projects LinkExtractor halLinks() (throwing NPE) does not work, because LinkExtractor would also need to support List<Map<String, Object>>and LinkExtractor accordingly (links instead of _links).

Support Multipart POST (e.g. file upload)

It appears that multipart form data documentation is not supported. For example, I would expect a sample request snippet to look something like this for POSTing a readme.txt file:

curl http://localhost:8080/imports -i -X POST
    -H "Content-Type: multipart/form-data"
    -F "file=@/Users/me/Desktop/readme.txt"

We have several multi-part endpoints, so would like to be able to document them properly. The above is not generated from something like this:

final MockMultipartFile uploadFile = new MockMultipartFile("file", new File("/Users/me/Desktop/readme.txt"), "text/plain", "bytes".getBytes());

mockMvc.perform(fileUpload("/imports")
    .file(uploadFile)
    .principal(principal())
    .header(AUTHORIZATION, basicAuth())
    .accept(APPLICATION_JSON))
    .andExpect(status().isAccepted())
    .andExpect(content().contentType(APPLICATION_JSON))
    .andDo(document("import-submit-example").withLinks(
        ... links ...
    ));

Custom host isn't respected in all documentation snippets

curl request snippets are correct:

curl https://api.example.com:8081/ -i -H "Accept: application/hal+json"

Responses are not:

HTTP/1.1 200 OK
Content-Type: application/hal+json

{
  "_links" : {
    "notes" : {
      "href" : "https://localhost:8081/notes"
    },
    "tags" : {
      "href" : "https://localhost:8081/tags"
    }
  }
}

Content-Type with charset is not supported

Having a request with a Content-Type header field set to 'application/json;charset=UTF-8' does not match a proper LinkExtractor. I expect to get an AtomLinkExtractor for all application/json content types.

Can't resolve snapshot from repo.spring.io

Looks like something might be wrong with the snapshot published to repo.spring.io?
I'm getting this error when I try to run the quickstart examples:

Could not resolve all dependencies for configuration ':testCompile'.
Artifact 'org.springframework.restdocs:spring-restdocs-core:0.1.0.BUILD-SNAPSHOT:spring-restdocs-core.jar' not found.
Searched in the following locations:
https://repo.spring.io/snapshot/org/springframework/restdocs/spring-restdocs-core/0.1.0.BUILD-SNAPSHOT/spring-restdocs-core-0.1.0.BUILD-20150113.124005-2.jar

I was able to work around by gradle install-ing spring-restdocs-core myself, but it might be confusing for people trying to run the examples.

swagger2asciidoc

Hello @wilkinsona,

thanks for creating spring-restdocs. It is a great inspiration for creating RESTful API documentations.

What do you think about my idea to combine swagger-springmvc and AsciiDoc to generate an AsciiDoc documentation of a Spring MVC RESTful API, comparable to GitHub’s API documentation.

https://github.com/RobWin/swagger2asciidoc

I plan to integrate spring-restdocs to show example request and response messages. It's still under development. But maybe you have some nice ideas for improvment.

Kind regards,

Robert Winkler

Approach for Microservices?

Very interested in implementing Restdocs for documenting our APIs. Maybe this is already possible, how do you handle documentation when each service is a Microservice?

The only way I can think of off the top of my head would require a parent pom and then each Microservice ends up being a Module. This doesn't feel like a right approach for Microservices. Another option would be git submodules "possibly".

Has there been any work on this approach?

Assertion of the `Location` header

This is more a question rather than an issue. So, the problem is during assertion of the Location header. Here is a test

@Test
    public void locationHeader() throws Exception {
        MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
                .apply(new RestDocumentationConfigurer().withScheme("http").withHost("api.server.com"))
                .alwaysDo(document("{method-name}-{step}")).build();
                // Here is how I do generate a location to assert against
        String location = linkTo(methodOn(TestController.class).bar()).toUri().toString();
        mockMvc.perform(get("/create").accept(MediaType.APPLICATION_JSON)).andExpect(
                header().string("Location", equalTo(location)));
    }

The controller on the other hand is:

    @RestController
    static class TestController {

        @RequestMapping(value = "/create", produces = MediaType.APPLICATION_JSON_VALUE)
        public ResponseEntity<Map<String, String>> bar() {
            Map<String, String> response = new HashMap<String, String>();
            response.put("a", "alpha");
            return ResponseEntity.created(linkTo(methodOn(TestController.class).bar()).toUri()).body(response);
        }
    }

And actually the result of the test:

Response header Location
Expected: "http://localhost/create"
     but: was "http://api.server.com:8080/create"
java.lang.AssertionError: Response header Location
Expected: "http://localhost/create"
     but: was "http://api.server.com:8080/create"

Can someone explain me how I can generate a header correctly?

Generate HTTP request snippets

In addition to the existing curl request snippets, HTTP request snippets, similar to those already produced for responses, would be useful.

Provide support for using alwaysDo to document a multi-step process

When documenting a multi-step process every MockMvc call that should be documented requires .andDo(document("foo")) to be called. It'd be nice if this call could be avoid by allowing alwaysDo(document("…")) to be called once in a setup method instead.

The tricky part is what to pass to document(). This string configures the output directory to which the documentation snippets are written. If a multi-step process uses the same directory for every step the snippets will be overwritten such that only the last step's snippets are available. To overcome this limitation the output directory could support a template with appropriate values being substituted each time snippets are documented, for example {method-name}-step-{step}. {method-name} would be replaced with the name of the current test method and {step} would be replaced with an incrementing count of steps that have been performed in that method.

Build failed on Windows platform

Hello,

The 2 tests of AsciidoctorWriterTests do not pass because of the line.separator which is '\r\n' on windows and not '\n' (expected by the test result).

This can be easily fixed by remplacing the '\n' occurences by '%s' in the expected String passed to the `String.format()' method :

String expectedOutput = String.format("%n[source,bash]%n----%n$ foo%n----%n%n");

Problems basing documentation on MockMVC.

First of all, thanks for the work so far on this project. I heard about this on the recent Spring webinar and I was excited to give it a try. I'd like to suggest a possible enhancement, but, I'm not really sure whether this goes against the basic principle of this project.

When using Spring Boot (or for any situations where it's just as easy to get a full embedded container up and running) there is arguably no need for MockMVC, and I believe it actually can do harm.

I followed one of the sample projects using Spring Boot and initialise MockMVC like this:

    @Autowired
    private WebApplicationContext context;
    private MockMvc mockMvc;

    @Before
    public void setUp() {
        this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
                .apply(new RestDocumentationConfigurer())
                .alwaysDo(document(getDocumentationName()))
                .build();
    }

However - and it could very easily be a lack of my understanding of MockMVC - I feel that there are issues with this:

  • When creating a MockMVC instance from a fully built WebApplicationContext it appears that not all filters are copied (for example Spring Security filters).
  • Other important configuration (such as the context path or some error handling logic) isn't used.

This means that if an app is always run on a path such as "/api/" e.g. "https://myhost/api/" there doesn't seem to be a way for the documentation to be aware of the "/api" path meaning all sample CURL requests won't work.

Furthermore, due to the lack of filters I have observed differences in actual runtime behaviour when compared with test behaviour in terms of response headers and error handling. E.g.

In tests if I do something like:

getMockMvc()
                .perform(get("/no-such-endpoint").accept(MediaType.APPLICATION_JSON))
                .andExpect(status().isNotFound());

I get simply

HTTP/1.1 404 Not Found

However, against the real app I get:

curl http://localhost:8080/api/no-such-endpoint -i -H "Accept: application/json"
HTTP/1.1 404 Not Found
Server: Apache-Coyote/1.1
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
X-Application-Context: application:development
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 24 Mar 2015 15:11:05 GMT

{
  "timestamp" : 1427209865283,
  "status" : 404,
  "error" : "Not Found",
  "message" : "No message available",
  "path" : "/api/no-such-endpoint"
}

I appreciate that the reason that none of the Spring Security headers are there is because of the filters not being present. But, there are also other potentially important differences such as the lack of response body.

I feel that an important attribute of documenting the API is that the documentation is as accurate as possible. This is why I like the idea of documentation being produced by tests.

I don't fully understand why these differences happen, but my suggestion would be that if at all possible this project could provide a special RestTemplate, e.g. DocumentingRestTemplate that could be used to make requests (instead of MockMvc) against a real embedded container and this way the results should be more accurate since it is a real version of the app.

Any thoughts or comments welcome and thanks so much for the work so far!

Question regarding generated documentation

Hello,

i've generated the documentation of the HATEOS example as described.
But it seems that

include::{generated}/index/request.asciidoc[]

do generate a Link to the generated content which is not interpreted as AsciiDoc.
The following is an image of the generated HTML documentation.

image

I thought it should be inline and processed by Asciidoctor? Or do I something wrong?

Kind regards,

Robert Winkler

Artifactory does not return latest version

I' m trying to fetch the latest version from the artifactory to fix the setup of my project (since some things have changed) but I do not get the latest one.

The version I'm getting is "0.1.0.BUILD-20150325.144113-28" while the latest is "0.1.0.BUILD-20150513.102043-51".

Just letting you know so that you can fix this or advice in case I'm doing something wrong.

Provide support for documenting query parameters

Having used spring-restdocs to document several of our hypermedia driven APIs, the only part that felt more manual than it perhaps could be, was the documentation of query parameters.

It would be good to be able to document these in a similar way to the withLinks() method, ideally with validation if any aren't specified.

I haven't had the chance to delve too much in to the code to know whether this is a valid suggestion! At some point I would like to contribute towards this project as I think the idea of tying the documenting to the tests is great.

Supporting postman collections

What do you guys think about supporting postman collections? It should be possible to integrate them in a similar manner as the curl documentation, although it could be tricky because a postman collection is described in one file.
As all the classes are re-instantiated on every call, one way of doing things would be trying to deserialize the given file into a list of postman-collection-models, append current request and overwrite the given file with the updated list.
A few changes would be needed in order to properly generify classes like SnippetWritingResultHandler for them to support different output writers. The mentioned ResultHandler is currently hardcoded to use the AsciiDoctorWriter.
I am not quite sure on what is the best way to do this, since I cannot really figure out, which class should be responsible for determining in which format the request/response is going to be documented.
Although writing out postman collections is just a matter of implementing a DocumentationWriter and DocumentationActions, it does not make much sense to use them in combination with the cURL stuff. So maybe classes like CurlDocumentation should decide which DocumentationWriter should be used to write the DocumentationAction.
I would happily support the implementation of this feature request.

Jersey's endpoints support

Andy, guys,

It seems that spring-restdocs does not see methods with javax.ws.rs.Path annotations? Is it possible to workaround somehow?

Build Failure on mvn package command [ cd samples/rest-notes-spring-hateoas ]

Getting this message on my terminal . Hope someone can help me on this .

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rest-notes-spring-hateoas ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 21 source files to /Users/bismoymurasing/Desktop/OpenSource/spring-restdocs/samples/rest-notes-spring-hateoas/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:47 min
[INFO] Finished at: 2015-04-17T16:37:41+05:30
[INFO] Final Memory: 16M/80M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project rest-notes-spring-hateoas: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Consider parameters when performing a POST request

Same than #26 for POST requests.

I have a test like

@Test
public void getTokenViaPostRequest() throws Exception {
    this.mvc.perform(
            post(URL_TOKEN)
                .param(PARAM_USERNAME, "user")
                .param(PARAM_PASSWORD, "userpwd"))
            .andExpect(status().isOk())
            .andDo(document("retrieveTokenViaPost"))
    ;
}

And I'd like to have a request example like

$ curl https://localhost:8080/token -i -X POST -d 'username=user&password=userpwd'

If you think it might be interesting I can make a pull request...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.