code: func APISchema(api *design.APIDefinition) *JSONSchema {
  	api.IterateResources(func(r *design.ResourceDefinition) error {
  		GenerateResourceDefinition(api, r)
  		return nil
  	})
  	scheme := "http"
  	if len(api.Schemes) > 0 {
  		scheme = api.Schemes[0]
  	}
  	u := url.URL{Scheme: scheme, Host: api.Host}
  	href := u.String()
  	links := []*JSONLink{
  		{
  			Href: href,
  			Rel:  "self",
  		},
  		{
  			Href:   "/schema",
  			Method: "GET",
  			Rel:    "self",
  			TargetSchema: &JSONSchema{
  				Schema:               SchemaRef,
  				AdditionalProperties: true,
  			},
  		},
  	}
  	s := JSONSchema{
  		ID:          fmt.Sprintf("%s/schema", href),
  		Title:       api.Title,
  		Description: api.Description,
  		Type:        JSONObject,
  		Definitions: Definitions,
  		Properties:  propertiesFromDefs(Definitions, "#/definitions/"),
  		Links:       links,
  	}
  	return &s
  }
docs: // APISchema produces the API JSON hyper schema.