praxis 0.22.pre.1 → 2.0.pre.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +5 -20
  3. data/CHANGELOG.md +328 -323
  4. data/lib/praxis.rb +13 -9
  5. data/lib/praxis/action_definition.rb +8 -10
  6. data/lib/praxis/action_definition/headers_dsl_compiler.rb +1 -1
  7. data/lib/praxis/api_definition.rb +27 -44
  8. data/lib/praxis/api_general_info.rb +2 -3
  9. data/lib/praxis/application.rb +15 -142
  10. data/lib/praxis/bootloader.rb +1 -2
  11. data/lib/praxis/bootloader_stages/environment.rb +13 -0
  12. data/lib/praxis/config.rb +1 -1
  13. data/lib/praxis/controller.rb +0 -2
  14. data/lib/praxis/dispatcher.rb +4 -6
  15. data/lib/praxis/docs/generator.rb +8 -18
  16. data/lib/praxis/docs/link_builder.rb +1 -1
  17. data/lib/praxis/error_handler.rb +5 -5
  18. data/lib/praxis/extensions/attribute_filtering/active_record_filter_query_builder.rb +1 -1
  19. data/lib/praxis/extensions/attribute_filtering/filtering_params.rb +1 -1
  20. data/lib/praxis/extensions/attribute_filtering/sequel_filter_query_builder.rb +125 -0
  21. data/lib/praxis/extensions/field_selection.rb +1 -12
  22. data/lib/praxis/extensions/field_selection/active_record_query_selector.rb +28 -34
  23. data/lib/praxis/extensions/field_selection/sequel_query_selector.rb +35 -39
  24. data/lib/praxis/extensions/rendering.rb +1 -1
  25. data/lib/praxis/file_group.rb +1 -1
  26. data/lib/praxis/handlers/xml.rb +1 -1
  27. data/lib/praxis/mapper/active_model_compat.rb +98 -0
  28. data/lib/praxis/mapper/resource.rb +242 -0
  29. data/lib/praxis/mapper/selector_generator.rb +154 -0
  30. data/lib/praxis/mapper/sequel_compat.rb +76 -0
  31. data/lib/praxis/media_type_identifier.rb +2 -1
  32. data/lib/praxis/middleware_app.rb +13 -15
  33. data/lib/praxis/multipart/part.rb +3 -5
  34. data/lib/praxis/notifications.rb +1 -1
  35. data/lib/praxis/plugins/mapper_plugin.rb +64 -0
  36. data/lib/praxis/request.rb +14 -7
  37. data/lib/praxis/request_stages/response.rb +2 -3
  38. data/lib/praxis/resource_definition.rb +15 -19
  39. data/lib/praxis/response.rb +6 -5
  40. data/lib/praxis/response_definition.rb +5 -7
  41. data/lib/praxis/response_template.rb +3 -4
  42. data/lib/praxis/responses/http.rb +36 -0
  43. data/lib/praxis/responses/internal_server_error.rb +12 -3
  44. data/lib/praxis/responses/multipart_ok.rb +11 -4
  45. data/lib/praxis/responses/validation_error.rb +10 -1
  46. data/lib/praxis/route.rb +1 -1
  47. data/lib/praxis/router.rb +3 -3
  48. data/lib/praxis/routing_config.rb +1 -1
  49. data/lib/praxis/tasks/api_docs.rb +2 -10
  50. data/lib/praxis/tasks/routes.rb +0 -1
  51. data/lib/praxis/trait.rb +1 -1
  52. data/lib/praxis/types/media_type_common.rb +2 -2
  53. data/lib/praxis/types/multipart.rb +1 -1
  54. data/lib/praxis/types/multipart_array.rb +2 -2
  55. data/lib/praxis/types/multipart_array/part_definition.rb +1 -1
  56. data/lib/praxis/version.rb +1 -1
  57. data/praxis.gemspec +11 -9
  58. data/spec/functional_spec.rb +0 -1
  59. data/spec/praxis/action_definition_spec.rb +16 -27
  60. data/spec/praxis/api_definition_spec.rb +8 -13
  61. data/spec/praxis/api_general_info_spec.rb +8 -3
  62. data/spec/praxis/application_spec.rb +8 -14
  63. data/spec/praxis/collection_spec.rb +3 -2
  64. data/spec/praxis/config_spec.rb +2 -2
  65. data/spec/praxis/extensions/field_selection/active_record_query_selector_spec.rb +106 -0
  66. data/spec/praxis/extensions/field_selection/sequel_query_selector_spec.rb +147 -0
  67. data/spec/praxis/extensions/field_selection/support/spec_resources_active_model.rb +130 -0
  68. data/spec/praxis/extensions/field_selection/support/spec_resources_sequel.rb +106 -0
  69. data/spec/praxis/handlers/xml_spec.rb +2 -2
  70. data/spec/praxis/mapper/resource_spec.rb +169 -0
  71. data/spec/praxis/mapper/selector_generator_spec.rb +325 -0
  72. data/spec/praxis/media_type_spec.rb +0 -10
  73. data/spec/praxis/middleware_app_spec.rb +16 -10
  74. data/spec/praxis/request_spec.rb +7 -17
  75. data/spec/praxis/request_stages/action_spec.rb +8 -1
  76. data/spec/praxis/request_stages/validate_spec.rb +1 -1
  77. data/spec/praxis/resource_definition_spec.rb +10 -12
  78. data/spec/praxis/response_definition_spec.rb +12 -26
  79. data/spec/praxis/response_spec.rb +6 -13
  80. data/spec/praxis/responses/internal_server_error_spec.rb +5 -2
  81. data/spec/praxis/router_spec.rb +5 -9
  82. data/spec/spec_app/app/controllers/instances.rb +1 -1
  83. data/spec/spec_app/config.ru +6 -1
  84. data/spec/spec_app/config/environment.rb +3 -21
  85. data/spec/spec_helper.rb +13 -17
  86. data/spec/support/be_deep_equal_matcher.rb +39 -0
  87. data/spec/support/spec_resources.rb +124 -0
  88. metadata +74 -53
  89. data/lib/praxis/extensions/attribute_filtering.rb +0 -28
  90. data/lib/praxis/extensions/attribute_filtering/query_builder.rb +0 -39
  91. data/lib/praxis/extensions/mapper_selectors.rb +0 -16
  92. data/lib/praxis/media_type_collection.rb +0 -127
  93. data/lib/praxis/plugins/praxis_mapper_plugin.rb +0 -246
  94. data/spec/praxis/media_type_collection_spec.rb +0 -157
  95. data/spec/praxis/plugins/praxis_mapper_plugin_spec.rb +0 -142
  96. data/spec/spec_app/app/models/person.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: c479acc3992139388b14120b7a76dde37e828ea034484786507f5a9b3fbb773f
4
- data.tar.gz: 87a961f20eb8b758584306fa1082a72c79432ca897fa6c5d4b3716f251defa02
2
+ SHA1:
3
+ metadata.gz: fa827ff7e042719b8976def88a05ab420fa05eb5
4
+ data.tar.gz: a3c09e65e43ea6d5ef508ca9be649552b271b305
5
5
  SHA512:
6
- metadata.gz: bcebeae7aa1dba132dbf3a28a9d14b359189f37a604817a7bba0ef1e4c1c9bffd9a89ab1bad553b6c4dbcccb53a362cc89ba1c3bdaf90f71adbf34f91e6d95ec
7
- data.tar.gz: 4d5c5600fb77f9e26384640a2b562fba88a63151e34f6d277a521e51661b3212a62c7d5f92a372f4bef95cbae4f39372970e0b9ffc2c94d819f9441c54d7ea2a
6
+ metadata.gz: 9055b2bb74579f7b0bfb6b2823df6b03dc863e30945314aa7d2251326ad1e4c7bf9a2213b24251ca8334e3e00bca5371b4fbc7d7199e7829ca4f625c9f1f0a97
7
+ data.tar.gz: e458dcf8e0d69e5df81ca9a2a1bc62250891ac788f7cfd2dbc9e08a76193bcf797d099799f83cfbdc0c2010e3fe3b23bef917efc036a80f95029f0437904f847
@@ -1,28 +1,13 @@
1
- language: ruby
2
- cache: bundler
3
1
  sudo: false
2
+ language: ruby
4
3
  rvm:
5
- - 2.3
6
4
  - 2.4
7
5
  - 2.5
8
6
  - 2.6
7
+ - 2.7
8
+ script:
9
+ - bundle exec rspec spec
9
10
  branches:
10
11
  only:
11
12
  - master
12
- before_install:
13
- - gem update --system # Due to: https://github.com/travis-ci/travis-ci/issues/8978
14
- # Leaving all API browser testing commented out as there are some very node dependencies that
15
- # need to be worked out and updated
16
- # node_js:
17
- # - "0.10"
18
- # before_install:
19
- # - nvm install 0.10
20
- # - node --version
21
- # - cd lib/api_browser
22
- # - npm install
23
- # - cd ../..
24
- # script:
25
- # - bundle exec rspec spec
26
- # - cd lib/api_browser
27
- # - npm test
28
- # - cd ../..
13
+ - /.*/
@@ -1,261 +1,271 @@
1
1
  # Praxis Changelog
2
2
 
3
3
  ## next
4
-
5
- * Builds an initial Rails embeddability/compatibility set of functions and helpers:
6
- * Refactored dispatcher methods so that instrumentation can be easily added on (but without building a flexible hook system that might decrease the performance)
7
- * Change `Praxis:Request` super classing to be definable by a module setter
8
- * Make `rails_compat/request_methods` to use it.
9
- * Built `rails_compat` extension. Which for now only:
10
- * changes `Praxis:Request` to derive from `ActionDispatch::Request`
11
- * Will load the RailsPlugin code
12
- * Built a `RailsPlugin` plugin which, for now, will:
13
- * emulate firing off the `action_controller` basic hooks (`start_processing` and `process_action`).
14
- * Add a few basic controller methods (which make some of the other mixing you might want to throw in your controllers happier). For example: the `head` method for controllers, as it is one of the most used for simple extensions. NOTE: The `render` method is not currently added.
15
- * NOTE: db and view runtime values on request processing not done (i.e., not integrated with Praxis’ DB or rendering frameworks)
16
- * Include URI in the primitive types when generating docs and displaying them (as to not have a generic URI schema polluting the lists)
17
- * Loosen up the version of Rack that Praxis requires. Adapted the old MultipartParser to be compabible with Rack 2x (but in reality we should see about reusing the brand new parser that 2x comes with in the future)
18
- * Loosen up the version of Mustermann to allow for their latest 1.x series (which will be used by some of the latest gems with Rails 5 and friends)
19
- * Fix and improve Doc Browser presentation
20
- * proper showing of substructures of payloads
21
- * mark required attrs with red star (and semi-required as orange)
22
- * display the existing special requirements as well
23
- * Added requirements for parameters as well (in addition to payload)
24
- * format member_options display better
25
- * Make `MiddleWareApp` initialize lazily. This allows the main rack app (i.e., Rails) to be fully initialized by the time any code in the Praxis middleware gets touched (i.e., full ActiveRecord connection initialization...etc.)
26
- * Removed 'Stats' plugin
27
- * CGI.decode filter values in the `FilteringParams` extension
4
+ - Reworked the field selection DB query generation to support full tree of eager loaded dependencies
5
+ - Built support for both ActiveRecord and Sequel gems
6
+ - Selected DB fields will include/map the defined resource properties and will always include any necessary fields on both sides of the joins for the given associations.
7
+ - Added a configurable option to enable debugging of those generated queries (through `Praxis::Application.instance.config.mapper.debug_queries=true`)
8
+
9
+ ## 2.0.pre.1
10
+
11
+ - Bring over partial functionality from praxis-mapper and remove dependency on same
12
+ - Praxis::Mapper's ::Resource and ::SelectorGenerator are now included
13
+ - General cleanup and simplification
14
+
15
+ ## 0.22.pre
16
+
17
+ - Builds an initial Rails embeddability/compatibility set of functions and helpers:
18
+ - Refactored dispatcher methods so that instrumentation can be easily added on (but without building a flexible hook system that might decrease the performance)
19
+ - Change `Praxis:Request` super classing to be definable by a module setter
20
+ - Make `rails_compat/request_methods` to use it.
21
+ - Built `rails_compat` extension. Which for now only:
22
+ - changes `Praxis:Request` to derive from `ActionDispatch::Request`
23
+ - Will load the RailsPlugin code
24
+ - Built a `RailsPlugin` plugin which, for now, will:
25
+ - emulate firing off the `action_controller` basic hooks (`start_processing` and `process_action`).
26
+ - Add a few basic controller methods (which make some of the other mixing you might want to throw in your controllers happier). For example: the `head` method for controllers, as it is one of the most used for simple extensions. NOTE: The `render` method is not currently added.
27
+ - NOTE: db and view runtime values on request processing not done (i.e., not integrated with Praxis’ DB or rendering frameworks)
28
+ - Include URI in the primitive types when generating docs and displaying them (as to not have a generic URI schema polluting the lists)
29
+ - Loosen up the version of Rack that Praxis requires. Adapted the old MultipartParser to be compabible with Rack 2x (but in reality we should see about reusing the brand new parser that 2x comes with in the future)
30
+ - Loosen up the version of Mustermann to allow for their latest 1.x series (which will be used by some of the latest gems with Rails 5 and friends)
31
+ - Fix and improve Doc Browser presentation
32
+ - proper showing of substructures of payloads
33
+ - mark required attrs with red star (and semi-required as orange)
34
+ - display the existing special requirements as well
35
+ - Added requirements for parameters as well (in addition to payload)
36
+ - format member_options display better
37
+ - Make `MiddleWareApp` initialize lazily. This allows the main rack app (i.e., Rails) to be fully initialized by the time any code in the Praxis middleware gets touched (i.e., full ActiveRecord connection initialization...etc.)
38
+ - Removed 'Stats' plugin
39
+ - CGI.decode filter values in the `FilteringParams` extension
28
40
 
29
41
  ## 0.21
30
42
 
31
- * Protect against `MediaType`s that do not have any links defined.
32
- * More robust scanning of existing types when generating docs. Some types might have not been
43
+ - Protect against `MediaType`s that do not have any links defined.
44
+ - More robust scanning of existing types when generating docs. Some types might have not been
33
45
  properly reported in the `schemas` section of the JSON docs if they were only used somewhere
34
46
  deep in some other type or action hierarchy
35
- * Build doc browser support for defining top-level home pages for types.
47
+ - Build doc browser support for defining top-level home pages for types.
36
48
  Apps can achieve the override by registering templates that respond to the ‘main’ type (instead of
37
49
  the other existing ‘label’,’embedded’ and ‘standalone’ modes).
38
- * Enhance doc browser to show header and location expectations on action responses that have them
50
+ - Enhance doc browser to show header and location expectations on action responses that have them
39
51
  defined
40
- * Allow Plugin registration without requiring config_key
41
- * registration will select a default config_key based on the class name
42
- * A new `documentation_url` global directive is exposed for authors to be able to
52
+ - Allow Plugin registration without requiring config_key
53
+ - registration will select a default config_key based on the class name
54
+ - A new `documentation_url` global directive is exposed for authors to be able to
43
55
  indicate where documentation will be hosted.
44
- * If this is provided, the default *validation handler* will add a `documentation`
56
+ - If this is provided, the default _validation handler_ will add a `documentation`
45
57
  key to the response pointing at a url that should correspond to the documentation
46
58
  for the resource the user was requesting.
47
- * `Praxis::Docs::LinkBuilder` can be used to generate these documentation urls from
59
+ - `Praxis::Docs::LinkBuilder` can be used to generate these documentation urls from
48
60
  the praxis application.
49
- * You can now switch your doc browser to use HTML5 style urls (i.e.
61
+ - You can now switch your doc browser to use HTML5 style urls (i.e.
50
62
  `/1.0/type/V1-MediaTypes-PriceFilter` instead of
51
63
  `/index.html#/1.0/type/V1-MediaTypes-PriceFilter`).
52
- * Remove deprecated rake tasks.
53
- * Remove some remaining inline styling in doc browser.
54
- * Adds a `ExampleProvider.removeHandlersForKey` call. You can use `ExampleProvider.removeHandlersForKey('general')`
64
+ - Remove deprecated rake tasks.
65
+ - Remove some remaining inline styling in doc browser.
66
+ - Adds a `ExampleProvider.removeHandlersForKey` call. You can use `ExampleProvider.removeHandlersForKey('general')`
55
67
  to get rid of the default example if required.
56
- * Make Traits accumulate block definitions for `params`,`headers` and `payload` rather than overriding them.
57
- * Switch to lazy evaluation of `base_params` from `ApiDefinition` to properly inherit them into the resources
68
+ - Make Traits accumulate block definitions for `params`,`headers` and `payload` rather than overriding them.
69
+ - Switch to lazy evaluation of `base_params` from `ApiDefinition` to properly inherit them into the resources
58
70
  and their corresponding actions even before the application's `MediaTtypes` have been finalized.
59
- * Built the `MiddlewareApp` class to make it easy to run a Praxis app mounted as an intercepting
71
+ - Built the `MiddlewareApp` class to make it easy to run a Praxis app mounted as an intercepting
60
72
  middleware which will only forward requests down the stack if they didn't match any of its routes.
61
- * Note: it properly skips forwarding when 404s are purposedly returned by the application itself.
62
- * Note2: it also respects the `X-Cascade=pass` conventions.
63
-
73
+ - Note: it properly skips forwarding when 404s are purposedly returned by the application itself.
74
+ - Note2: it also respects the `X-Cascade=pass` conventions.
64
75
 
65
76
  ## 0.20.1
66
77
 
67
- * Doc generation: handle SimpleMediaTypes so that they don’t show up in the generated schemas.
68
- * Ensure we require AS#Enumerable extension is loaded, which is required in the generator code.
69
- * Add Date to the list of primitive types so that it does not show in the generated schemas.
70
- * Enhance the `:created` response_template, so that it can take the associated media_type
71
- * Doc Browser: fix route display to have the captures instead of the example
78
+ - Doc generation: handle SimpleMediaTypes so that they don’t show up in the generated schemas.
79
+ - Ensure we require AS#Enumerable extension is loaded, which is required in the generator code.
80
+ - Add Date to the list of primitive types so that it does not show in the generated schemas.
81
+ - Enhance the `:created` response_template, so that it can take the associated media_type
82
+ - Doc Browser: fix route display to have the captures instead of the example
72
83
 
73
84
  ## 0.20.0
74
85
 
75
- * You can now add a `bower.json` file to your `docs` folder. Any dependencies
86
+ - You can now add a `bower.json` file to your `docs` folder. Any dependencies
76
87
  you list there will be included in the doc browser.
77
- * The Plugin API now exposes `Praxis::Plugin#register_doc_browser_plugin(path)`,
88
+ - The Plugin API now exposes `Praxis::Plugin#register_doc_browser_plugin(path)`,
78
89
  which allows plugins to register assets that will be included in the doc browser.
79
90
  This is a convenient way to share customizations and optional features amongst
80
91
  different API projects.
81
- * Fixes an issue where an odd scrollbar would appear in some cases in the doc browser.
82
- * Fixed a corner-case in doc generation which could omit certain existing MediaTypes
92
+ - Fixes an issue where an odd scrollbar would appear in some cases in the doc browser.
93
+ - Fixed a corner-case in doc generation which could omit certain existing MediaTypes
83
94
  (when these existed but there were never referenced in any other part of the app).
84
- * Added `ApiGeneralInfo` to supported modules a `PluginConcern` can extend.
85
- * Fixed `MediaType` support for attributor advanced requirements.
86
- * Doc Browser now exposes an API to register functions that generate code examples.
95
+ - Added `ApiGeneralInfo` to supported modules a `PluginConcern` can extend.
96
+ - Fixed `MediaType` support for attributor advanced requirements.
97
+ - Doc Browser now exposes an API to register functions that generate code examples.
87
98
  These can be registered with `ExamplesProvider.register` call.
88
99
 
89
100
  ## 0.19.0
90
101
 
91
- * Handle loading empty `MediaTypeIdentifier` values (to return `nil`)
92
- * Doc browser now displays examples for action responses.
93
- * Added `Controller#media_type` helper that returns the `media_type` defined
94
- for the current response, or defaults to the one defined by the controller's
95
- resource definition.
96
- * Added assorted extensions, all under the `Praxis::Extensions` module:
97
- * `FieldSelection` adds a new type, `Praxis::Extensions::FieldSelection::FieldSelector`
102
+ - Handle loading empty `MediaTypeIdentifier` values (to return `nil`)
103
+ - Doc browser now displays examples for action responses.
104
+ - Added `Controller#media_type` helper that returns the `media_type` defined
105
+ for the current response, or defaults to the one defined by the controller's
106
+ resource definition.
107
+ - Added assorted extensions, all under the `Praxis::Extensions` module:
108
+ - `FieldSelection` adds a new type, `Praxis::Extensions::FieldSelection::FieldSelector`
98
109
  that wraps the `Attributor::FieldSelector` type and improves the definition
99
110
  of parameters for a set of fields. Must be required explicitly from
100
111
  'praxis/extensions/field_selection'.
101
- * The parsed set of fields will be available as the `fields` accessor of
112
+ - The parsed set of fields will be available as the `fields` accessor of
102
113
  the loaded value.
103
- * For example, to define a parameter that should take a set of fields
114
+ - For example, to define a parameter that should take a set of fields
104
115
  for a `Person` media type, you would define a `:fields` attribute in the
105
116
  params like: `attribute :fields, FieldSelector.for(Person)`. The parsed
106
117
  fields in the request would then be available with
107
118
  `request.params.fields.fields`.
108
- * `Rendering` adds `render` and `display` helper methods to controllers to
109
- reduce common boilerplate in producing rendered representations of media types
110
- and setting response "Content-Type" headers.
111
- * `Controller#render(object, include_nil: false)` loads `object` into the
112
- the current applicable `MediaType` (as from `Controller#media_type`) and
113
- renders it using the fields provided by `Controller#expanded_fields` (from the
119
+ - `Rendering` adds `render` and `display` helper methods to controllers to
120
+ reduce common boilerplate in producing rendered representations of media types
121
+ and setting response "Content-Type" headers.
122
+ - `Controller#render(object, include_nil: false)` loads `object` into the
123
+ the current applicable `MediaType` (as from `Controller#media_type`) and
124
+ renders it using the fields provided by `Controller#expanded_fields` (from the
114
125
  `FieldExpansion` extension).
115
- * `Controller#display(object, include_nil: false)` calls `render` (above) with
126
+ - `Controller#display(object, include_nil: false)` calls `render` (above) with
116
127
  `object`, assigns the result to the current `response.body`, sets the
117
128
  response's "Content-Type" header to the appropriate MediaType identifier,
118
129
  and returns the response.
119
- * To use this extension, include it in a controller with
130
+ - To use this extension, include it in a controller with
120
131
  `include Praxis::Extensions::Rendering`.
121
- * `MapperSelectors` adds `Controller#set_selectors`, which sets selectors
132
+ - `MapperSelectors` adds `Controller#set_selectors`, which sets selectors
122
133
  in the controller's `identity_map` to ensure any fields and associations
123
134
  necessary to render the `:view` and/or `:fields` params specified in the
124
135
  request are loaded for a given model when `identity_map.load(model)` is called.
125
- * To use this extension, include it in a controller with
136
+ - To use this extension, include it in a controller with
126
137
  `include Praxis::Extensions::MapperSelectors`, and define `before`
127
138
  callbacks on relevant actions that call `set_selectors`. For example:
128
139
  `before actions: [:index, :show] { |controller| controller.set_selectors }`
129
- * `FieldExpansion` provides a `Controller#expanded_fields` helper for
130
- processing `:view` and/or `:fields` params to determine the final set fields
131
- necessary to handle the request.
132
- * Note: This is primarily an internal extension used by the `MapperSelectors`
133
- and `Rendering` extensions, and is automatically included by them.
134
- * A slew of Doc browser improvements:
135
- * Now uses the new JSON format for responses.
136
- * Traits now get exposed in the doc browser.
137
- * Now displays examples for requesting actions.
138
- * Now correctly displays top-level collections in action payloads.
139
- * Has improved scrolling for the sidebar.
140
- * Displays more detailed HTML titles.
141
- * Has been switched back to having a separate page per action, however actions are now shown in the sidebar.
142
- * Will now display multiply nested resources in a proper hierarchy.
143
- * Fix doc generator to only output versions in index for which we have resources (i.e. some can be nodoc!)
140
+ - `FieldExpansion` provides a `Controller#expanded_fields` helper for
141
+ processing `:view` and/or `:fields` params to determine the final set fields
142
+ necessary to handle the request.
143
+ - Note: This is primarily an internal extension used by the `MapperSelectors`
144
+ and `Rendering` extensions, and is automatically included by them.
145
+ - A slew of Doc browser improvements:
146
+ - Now uses the new JSON format for responses.
147
+ - Traits now get exposed in the doc browser.
148
+ - Now displays examples for requesting actions.
149
+ - Now correctly displays top-level collections in action payloads.
150
+ - Has improved scrolling for the sidebar.
151
+ - Displays more detailed HTML titles.
152
+ - Has been switched back to having a separate page per action, however actions are now shown in the sidebar.
153
+ - Will now display multiply nested resources in a proper hierarchy.
154
+ - Fix doc generator to only output versions in index for which we have resources (i.e. some can be nodoc!)
144
155
 
145
156
  ## 0.18.1
146
157
 
147
- * Fix Doc Browser regression, which would not show the schema in the Resource Definition home page.
158
+ - Fix Doc Browser regression, which would not show the schema in the Resource Definition home page.
148
159
 
149
160
  ## 0.18.0
150
161
 
151
- * Added `display_name` DSL to `ResourceDefinition` and `MediaType`
152
- * It is a purely informational field, mostly to be used by consumers of the generated docs
153
- * It defaults to the class name (stripping any of the prefix modules)
154
- * Revamped document generation to output a more compact format:
155
- * 1 file per api version: including info, resources, schemas and traits.
156
- * 1 single index file with global info plus just a list of version names
157
- * new task currently usable through `bundle exec rake praxis:docs:generate_beta`
158
- * NOTE: leaves the current doc generation tasks and code intact (until the doc browser is switched to use this)
159
- * Specialized `Multipart`’s family in its description to be ‘multipart’ instead of ‘hash’.
160
- * Added `Praxis::Handlers::FormData` for 'multipart/form-data'. Currently returns the input unchanged in `parse` and `generate`.
161
- * Added `Praxis::Handlers::WWWForm` for form-encoded data.
162
- * Added `Docs::Generator`, experimental new documentation generator. Use the `praxis:docs:experiments` rake task to generate. *Note*: not currently compatible with the documentation browser.
163
- * Added 'praxis.request_stage.execute' `ActiveSupport::Notifications` instrumentation to contorller action method execution in `RequestStages::Action#execute`.
164
- * Make action headers, params and payloads be required by default as it is probably what most people expect from it. To make any of those three definitions non-required, simply add the `:required` option as used in any other attribute definition. For example: `payload required: false do ...`
162
+ - Added `display_name` DSL to `ResourceDefinition` and `MediaType`
163
+ - It is a purely informational field, mostly to be used by consumers of the generated docs
164
+ - It defaults to the class name (stripping any of the prefix modules)
165
+ - Revamped document generation to output a more compact format:
166
+ - 1 file per api version: including info, resources, schemas and traits.
167
+ - 1 single index file with global info plus just a list of version names
168
+ - new task currently usable through `bundle exec rake praxis:docs:generate_beta`
169
+ - NOTE: leaves the current doc generation tasks and code intact (until the doc browser is switched to use this)
170
+ - Specialized `Multipart`’s family in its description to be ‘multipart’ instead of ‘hash’.
171
+ - Added `Praxis::Handlers::FormData` for 'multipart/form-data'. Currently returns the input unchanged in `parse` and `generate`.
172
+ - Added `Praxis::Handlers::WWWForm` for form-encoded data.
173
+ - Added `Docs::Generator`, experimental new documentation generator. Use the `praxis:docs:experiments` rake task to generate. _Note_: not currently compatible with the documentation browser.
174
+ - Added 'praxis.request_stage.execute' `ActiveSupport::Notifications` instrumentation to contorller action method execution in `RequestStages::Action#execute`.
175
+ - Make action headers, params and payloads be required by default as it is probably what most people expect from it. To make any of those three definitions non-required, simply add the `:required` option as used in any other attribute definition. For example: `payload required: false do ...`
165
176
 
166
177
  ## 0.17.1
167
178
 
168
- * Fixes an issue that would make exported documentation broken.
169
- * Fixes an issue that would make the version selector broken.
179
+ - Fixes an issue that would make exported documentation broken.
180
+ - Fixes an issue that would make the version selector broken.
170
181
 
171
182
  ## 0.17.0
172
183
 
173
- * Merges action details pages into one long page in doc browser
174
- * Refined path-based versioning:
175
- * Added `ApiGeneralInfo#version_with`, which defaults to `[:header, :params`] and may be set to `:path` to use path-based versioning.
176
- * Added support for specifying an `:api_version` placeholder to the global version's `ApiGeneralInfo#base_path`.
177
- * Deprecated `ResourceDefinition.version using: :path` option, use `ApiGeneralInfo#version_with` instead.
178
- * Fix bug where before/after hooks set on sub-stages of `:app` would not be triggered
179
- * Refactors the api browser to allow registering custom type templates.
180
- * This also removes an undocumented feature that did something similar.
181
- * Fixes an issue where Struct properties wouldn't be displayed.
182
- * Added `endpoint` directive to global API info, only used for documentation purposes.
183
- * Added `ResourceDefinition.parent` directive to define a parent resource.
184
- * The parent's `canonical_path` is used as the base of the child's routes.
185
- * Any parameters in the parent's route will also be applied as defaults in the child. The last route parameter is assumed to be an 'id'-type parameter, and is prefixed with the parent's snake-cased singular name. I.e., `id` from a `Volume` parent will be renamed to `volume_id`. Any other parameters are copied unchanged.
186
- * This behavior can be overridden by providing a mapping hash of the form `{parent_name => child_name}` to the `parent` directive. See [VolumeSnapshots](spec/spec_app/design/resources/volume_snapshots.rb) for an example.
187
- * Backwards incompatible Change: Refactored `ValidationError` to be more consistent with the reported fields
188
- * Changed `message` for `summary`. Always present, and should provide a quick description of the type of error encountered. For example: "Error loading payload data"
189
- * Semantically changed `errors` to always have the details of one or many errors that have occurred. For example: "Unknown key received: :foobar while loading $.payload.user"
190
- * Note: if you are an application that used and tested against the previous `message` field you will need to adjust your tests to check for the values in the `summary` field and or the `errors` contents. But it will now be a much more consistent experience that will allow API clients to notify of the exact errors and details to their clients.
191
- * Added `Application.validation_handler` to customize response generation for validation errors. See [validation_handler.rb](lib/praxis/validation_handler.rb) for default version.
192
- * Copied mustermann's routers to praxis repo in anticipation of their removal from mustermann itself.
193
- * Added response body validation.
194
- * Validation is controlled by the `praxis.validate_response_bodies` boolean
195
- config option, and uses the `media_type` defined for the response definition.
196
- * Added `location:` option to `Responses::Created.new`.
197
- * `ResourceDefinition.parse_href` now accepts any instance of `URI::Generic` in addition to a string.
198
- * Fixed path generation for nested ResourceDefinitions
199
- * Substantial changes and improvements to multipart request and response handling:
200
- * Added `Praxis::Types::MultipartArray`, a type of `Attributor::Collection` with `Praxis::MultipartPart` members that allows the handling of duplicate named parts and unnamed ones. The new type supports defining many details about the expected structure of the parts, including headers, payloads, names and filename information. In addition, this type is able to load and validate full multipart bodies into the expected type structure, generate example objects as well as dump them into a full multipart body including boundaries and properly encoded parts following their content-types. See documentation for details and more features.
201
- * Made `Praxis::MultipartPart` a proper `Attributor::Type`.
202
- * Added `Praxis::Responses:MultipartOk` properly returning `MultipartArray` responses.
203
- * Deprecated `Praxis::Multipart`. A replacement for true hash-like behavior will be added before their removal in 1.0.
204
- * `ActionDefinition#response` now accepts an optional second `type` parameter, and optional block to further define that type. The `type` provided will be used to specify the `media_type` option to pass to the corresponding `ResponseDefinition`.
205
- * The `header` directive inside `ActionDefinition#headers` now accepts an optional second `type` parameter that may be used to override the default `String` type that would be used.
206
- * Added `Praxis::Handlers::Plain` encoder for 'text/plain'.
207
- * Fixed `Praxis::Handlers::XML ` handler to transform dashes to underscores and treat empty hashes like ActiveSupport does.
208
- * Adds hierarchival navigation to the doc browser.
209
- * Adds a ConfigurationProvider allowing for easy doc customization.
210
-
184
+ - Merges action details pages into one long page in doc browser
185
+ - Refined path-based versioning:
186
+ - Added `ApiGeneralInfo#version_with`, which defaults to `[:header, :params`] and may be set to `:path` to use path-based versioning.
187
+ - Added support for specifying an `:api_version` placeholder to the global version's `ApiGeneralInfo#base_path`.
188
+ - Deprecated `ResourceDefinition.version using: :path` option, use `ApiGeneralInfo#version_with` instead.
189
+ - Fix bug where before/after hooks set on sub-stages of `:app` would not be triggered
190
+ - Refactors the api browser to allow registering custom type templates.
191
+ - This also removes an undocumented feature that did something similar.
192
+ - Fixes an issue where Struct properties wouldn't be displayed.
193
+ - Added `endpoint` directive to global API info, only used for documentation purposes.
194
+ - Added `ResourceDefinition.parent` directive to define a parent resource.
195
+ - The parent's `canonical_path` is used as the base of the child's routes.
196
+ - Any parameters in the parent's route will also be applied as defaults in the child. The last route parameter is assumed to be an 'id'-type parameter, and is prefixed with the parent's snake-cased singular name. I.e., `id` from a `Volume` parent will be renamed to `volume_id`. Any other parameters are copied unchanged.
197
+ - This behavior can be overridden by providing a mapping hash of the form `{parent_name => child_name}` to the `parent` directive. See [VolumeSnapshots](spec/spec_app/design/resources/volume_snapshots.rb) for an example.
198
+ - Backwards incompatible Change: Refactored `ValidationError` to be more consistent with the reported fields
199
+ - Changed `message` for `summary`. Always present, and should provide a quick description of the type of error encountered. For example: "Error loading payload data"
200
+ - Semantically changed `errors` to always have the details of one or many errors that have occurred. For example: "Unknown key received: :foobar while loading \$.payload.user"
201
+ - Note: if you are an application that used and tested against the previous `message` field you will need to adjust your tests to check for the values in the `summary` field and or the `errors` contents. But it will now be a much more consistent experience that will allow API clients to notify of the exact errors and details to their clients.
202
+ - Added `Application.validation_handler` to customize response generation for validation errors. See [validation_handler.rb](lib/praxis/validation_handler.rb) for default version.
203
+ - Copied mustermann's routers to praxis repo in anticipation of their removal from mustermann itself.
204
+ - Added response body validation.
205
+ - Validation is controlled by the `praxis.validate_response_bodies` boolean
206
+ config option, and uses the `media_type` defined for the response definition.
207
+ - Added `location:` option to `Responses::Created.new`.
208
+ - `ResourceDefinition.parse_href` now accepts any instance of `URI::Generic` in addition to a string.
209
+ - Fixed path generation for nested ResourceDefinitions
210
+ - Substantial changes and improvements to multipart request and response handling:
211
+ - Added `Praxis::Types::MultipartArray`, a type of `Attributor::Collection` with `Praxis::MultipartPart` members that allows the handling of duplicate named parts and unnamed ones. The new type supports defining many details about the expected structure of the parts, including headers, payloads, names and filename information. In addition, this type is able to load and validate full multipart bodies into the expected type structure, generate example objects as well as dump them into a full multipart body including boundaries and properly encoded parts following their content-types. See documentation for details and more features.
212
+ - Made `Praxis::MultipartPart` a proper `Attributor::Type`.
213
+ - Added `Praxis::Responses:MultipartOk` properly returning `MultipartArray` responses.
214
+ - Deprecated `Praxis::Multipart`. A replacement for true hash-like behavior will be added before their removal in 1.0.
215
+ - `ActionDefinition#response` now accepts an optional second `type` parameter, and optional block to further define that type. The `type` provided will be used to specify the `media_type` option to pass to the corresponding `ResponseDefinition`.
216
+ - The `header` directive inside `ActionDefinition#headers` now accepts an optional second `type` parameter that may be used to override the default `String` type that would be used.
217
+ - Added `Praxis::Handlers::Plain` encoder for 'text/plain'.
218
+ - Fixed `Praxis::Handlers::XML` handler to transform dashes to underscores and treat empty hashes like ActiveSupport does.
219
+ - Adds hierarchival navigation to the doc browser.
220
+ - Adds a ConfigurationProvider allowing for easy doc customization.
211
221
 
212
222
  ## 0.16.1
213
223
 
214
- * Fixed a bug where documentation generation would fail if an application had headers in a Trait using the simplified `header` DSL.
224
+ - Fixed a bug where documentation generation would fail if an application had headers in a Trait using the simplified `header` DSL.
215
225
 
216
226
  ## 0.16.0
217
227
 
218
- * Overhauled traits: they're now represented by a `Trait` class, which are created from `ApiDefinition#trait`.
219
- * `ApiDefinition#describe` will also include details of the defined traits.
220
- * `ResourceDefinition#describe` and `ActionDefinition#describe` will also include the names of the used traits.
221
- * *Note*: this may break some existing trait use cases, as they are now more-defined in their behavior, rather than simply stored blocks that are `instance_eval`-ed on the target.
222
- * Deprecated `ResourceDefinition.routing`. Use `ResourceDefinition.prefix` to define resource-level route prefixes instead.
223
- * Significantly refactored route generation.
224
- * The `base_path` property defined in `ApiDefinition#info` will now appear in the routing paths 'base' (instead of simply being used for documentation purposes).
225
- *Note*: unlike other info at that level, a global (unversioned) `base_path` is *not* overriden by specific version, rather the specific version's path is appended to the global path.
226
- * Any prefixes set on a `ResourceDefinition` or inside a `routing` block of an ActionDefinition are now additive. For example:
227
- * Setting a "/myresource" prefix in a "MyResource" definition, and setting a "/myaction" prefix within an action of that resource definition will result in a route containing the following segments ".../myresource/myaction...".
228
- * Prefixes can be equally set by including `Traits`, which will follow exactly the same additive rules.
229
- * To break the additive nature of the prefixes one can use a couple of different options:
230
- * Define the action route path with "//" to make it absolute, i.e. a path like "//people" would not include any defined prefix.
231
- * Explicitly clear the prefix by setting the prefix to `''` or `'//'`.
232
- * Added `base_params` to `ApiDefinition#info` as a way to share common action params
233
- * `base_params` may be defined for a specific Api version, which will make sharing params across all Resource definitions of that version)
234
- * or `base_params` may be defined in the Global Api section, which will make the parameters shared across all actions of all defined Api versions.
235
- * Fixed `MediaType#describe` to include the correct string representation of its identifier.
236
- * Allow route options to be passed to the underlying router (i.e. Mustermann at the moment)
237
- * routes defined in the `routing` blocks can now take any extra options which will be passed down to the Mustermann routing engine. Unknown options will be ignored!
238
- * Displaying routes (`praxis routes` or `rake praxis:routes`) will now include any options defined in a route.
239
- * Added an example on the instances resource of the embedded spec_app to show how to use the advanced `*` pattern and the `:except` Mustermann options (along with the required `:splat` attribute).
240
- * Spruced up the example app (generator) to use the latest `prefix` and `trait` changes
228
+ - Overhauled traits: they're now represented by a `Trait` class, which are created from `ApiDefinition#trait`.
229
+ - `ApiDefinition#describe` will also include details of the defined traits.
230
+ - `ResourceDefinition#describe` and `ActionDefinition#describe` will also include the names of the used traits.
231
+ - _Note_: this may break some existing trait use cases, as they are now more-defined in their behavior, rather than simply stored blocks that are `instance_eval`-ed on the target.
232
+ - Deprecated `ResourceDefinition.routing`. Use `ResourceDefinition.prefix` to define resource-level route prefixes instead.
233
+ - Significantly refactored route generation.
234
+ - The `base_path` property defined in `ApiDefinition#info` will now appear in the routing paths 'base' (instead of simply being used for documentation purposes).
235
+ _Note_: unlike other info at that level, a global (unversioned) `base_path` is _not_ overriden by specific version, rather the specific version's path is appended to the global path.
236
+ - Any prefixes set on a `ResourceDefinition` or inside a `routing` block of an ActionDefinition are now additive. For example:
237
+ - Setting a "/myresource" prefix in a "MyResource" definition, and setting a "/myaction" prefix within an action of that resource definition will result in a route containing the following segments ".../myresource/myaction...".
238
+ - Prefixes can be equally set by including `Traits`, which will follow exactly the same additive rules.
239
+ - To break the additive nature of the prefixes one can use a couple of different options:
240
+ - Define the action route path with "//" to make it absolute, i.e. a path like "//people" would not include any defined prefix.
241
+ - Explicitly clear the prefix by setting the prefix to `''` or `'//'`.
242
+ - Added `base_params` to `ApiDefinition#info` as a way to share common action params
243
+ - `base_params` may be defined for a specific Api version, which will make sharing params across all Resource definitions of that version)
244
+ - or `base_params` may be defined in the Global Api section, which will make the parameters shared across all actions of all defined Api versions.
245
+ - Fixed `MediaType#describe` to include the correct string representation of its identifier.
246
+ - Allow route options to be passed to the underlying router (i.e. Mustermann at the moment)
247
+ - routes defined in the `routing` blocks can now take any extra options which will be passed down to the Mustermann routing engine. Unknown options will be ignored!
248
+ - Displaying routes (`praxis routes` or `rake praxis:routes`) will now include any options defined in a route.
249
+ - Added an example on the instances resource of the embedded spec_app to show how to use the advanced `*` pattern and the `:except` Mustermann options (along with the required `:splat` attribute).
250
+ - Spruced up the example app (generator) to use the latest `prefix` and `trait` changes
241
251
 
242
252
  ## 0.15.0
243
253
 
244
- * Fixed handling of no app or design file groups defined in application layout.
245
- * Handled and added warning message for doc generation task when no routing block is defined for an action.
246
- * Improved `link` method in `MediaType` attribute definition to support inheriting the type from the `:using` option if if that specifies an attribute. For example: `link :posts, using: :posts_summary` would use the type of the `:posts_summary` attribute.
247
- * Fixed generated `Links` accessors to properly load the returned value.
248
- * Added `MediaTypeIdentifier` class to parse and manipulate Content-Type headers and Praxis::MediaType identifiers.
249
- * Created a registry for media type handlers that parse and generate document bodies with formats other than JSON.
250
- * Given a structured-data response, Praxis will convert it to JSON, XML or other formats based on the handler indicated by its Content-Type.
251
- * Given a request, Praxis will use the handler indicated by its Content-Type header to parse the body into structured data.
252
- * Fixed bug allowing "praxis new" to work when Praxis is installed as a system (non-bundled) gem.
253
- * Fixed doc generation code for custom types
254
- * Hardened Multipart type loading
254
+ - Fixed handling of no app or design file groups defined in application layout.
255
+ - Handled and added warning message for doc generation task when no routing block is defined for an action.
256
+ - Improved `link` method in `MediaType` attribute definition to support inheriting the type from the `:using` option if if that specifies an attribute. For example: `link :posts, using: :posts_summary` would use the type of the `:posts_summary` attribute.
257
+ - Fixed generated `Links` accessors to properly load the returned value.
258
+ - Added `MediaTypeIdentifier` class to parse and manipulate Content-Type headers and Praxis::MediaType identifiers.
259
+ - Created a registry for media type handlers that parse and generate document bodies with formats other than JSON.
260
+ - Given a structured-data response, Praxis will convert it to JSON, XML or other formats based on the handler indicated by its Content-Type.
261
+ - Given a request, Praxis will use the handler indicated by its Content-Type header to parse the body into structured data.
262
+ - Fixed bug allowing "praxis new" to work when Praxis is installed as a system (non-bundled) gem.
263
+ - Fixed doc generation code for custom types
264
+ - Hardened Multipart type loading
255
265
 
256
266
  ## 0.14.0
257
267
 
258
- * Adds features for customizing and exporting the Doc browser, namely the following changes:
268
+ - Adds features for customizing and exporting the Doc browser, namely the following changes:
259
269
  1. All doc browser stuff is now centralised under the `praxis:docs` namespace.
260
270
  2. The doc browser requires node.js. (TODO: add this to the docs PR)
261
271
  3. `rake praxis:docs:generate` generates the JSON schema files. `rake praxis:api_docs` is now an alias of this with the idea that `rake praxis:api_docs` will be deprecated.
@@ -266,163 +276,158 @@ config option, and uses the `media_type` defined for the response definition.
266
276
  8. The default `docs/styles.scss` simply `@import 'praxis'`. However this means the user can override any of bootstraps variables allowing for easy theme customisation. Rules etc. can now also be overridden.
267
277
  9. Any templates defined in `docs/views` take precedence over those defined in the doc browser. This means the user can easily customise parts of the app, while leaving the rest up to us.
268
278
  10. Any changes to the above customisations will be automatically reloaded on save.
269
- * First pass at describing (and doc-generating) API global information
270
- * Inside a `Praxis::ApiDefinition.define` block one can now specify a few things about the API by using:
271
- * info("1.0") `<block>` - Which will apply to a particular version only
272
- * info `<block>` - Which will be inherited by any existing API version
273
- * The current pieces of information that can be defined in the block are: `name`, `title`, `description` and `basepath`. See [this](https://github.com/rightscale/praxis/blob/master/spec/spec_app/design/api.rb) for details
274
- * NOTE: This information is output to the JSON files, BUT not used in the doc browser yet.
275
- * Changed the doc generation and browser to use "ids" instead of "names" for routes and generated files.
276
- * Currently, "ids" are generated using dashes instead of double colons (instead of random ids). This closes issue #31.
277
- * Added the definition and handling of canonical urls for API resources
278
- * One can now specify which action URL should be considered as the canonical resource href:
279
- * by using `canonical_path <action_name>` at the top of the resource definition class
280
- * See the [instances](https://github.com/rightscale/praxis/blob/master/spec/spec_app/design/resources/instances.rb) resource definition for an example.
281
- * With a canonical href defined, one can then both generate and parse them by using:
282
- * `.to_href(<named arguments hash>) => <href String>`
283
- * `.parse_href( <href String> ) => < named arguments hash >`. Note: The returned arguments are properly typed-coerced.
284
- * These helpers can be accessed from:
285
- * the `definition` object in the controller instance (i.e., `self.definition.to_href(id: 1). )
286
- * or through the class-level methods in the resource definition (i.e. `MyApiResource.parse_href("/my_resource/1")` )
287
- * Hooked up rake tasks into the `praxis` binary for convenience. In particular
288
- * praxis routes [json]
289
- * praxis docs [browser]
290
- * praxis console
291
- * Added `MediaTypeCommon` module, which contains the `identifier`, `description`, and `describe` methods formerly found in `MediaType`. This is now the module used for checking whether a given class should be included in generated documentation, or is valid for use in a `ResponseDefinition`
292
- * Improved `Praxis::Collection.of` when used with MediaTypes
293
- * It will now define an inner `<media_type>::Collection` type that is an `Attributor::Collection` of the MediaType that also will include the `MediaTypeCommon` module.
294
- * By default, Praxis will take the identifier of the parent `MediaType` and append a `collection=true` suffix to it.
295
- * Fixed `ResponseDefinition` Content-Type validation to properly handle parameters (i.e., "application/json;collection=true").
296
- * Note: For "index" type actions, this now means Praxis will properly validate any 'collection=true' parameter specified in the `ResponseDefintion` and set by the controller.
297
- * Deprecated `MediaTypeCollection`. Please define separate classes and attributes for "collection" and "summary" uses.
298
- * Improved code for stages
299
- * `setup!` is no longer called within the `run` default code of a stage
300
- * removed unnecessary raise error when substages are empty (while not common it can be possible, and totally valid)
301
- * Add `Response` to supported classes in `PluginConcern`
302
- * Fix doc generation to use `ids` for top-level types (rather than names) so they are correctly linkable.
303
- * Doc Browser: Added support for Markdown rendering of descriptions (for resources, media_types, attributes, etc...)
304
- * Added test framework for the doc browser. Run the tests with `grunt test` from lib/api_browser.
305
- * Enhanced the `praxis:docs:preview` rake task with an optional port parameter
306
- * Fixed praxis:routes rake task to support actions that do not have routes defined
307
- * Added `:source` to `ActionDefinition` parameter descriptions with the value of either 'url' or 'query' to denote where the parameter is (typically) extracted from. Note: not currently shown in doc browser.
279
+ - First pass at describing (and doc-generating) API global information
280
+ - Inside a `Praxis::ApiDefinition.define` block one can now specify a few things about the API by using:
281
+ - info("1.0") `<block>` - Which will apply to a particular version only
282
+ - info `<block>` - Which will be inherited by any existing API version
283
+ - The current pieces of information that can be defined in the block are: `name`, `title`, `description` and `basepath`. See [this](https://github.com/rightscale/praxis/blob/master/spec/spec_app/design/api.rb) for details
284
+ - NOTE: This information is output to the JSON files, BUT not used in the doc browser yet.
285
+ - Changed the doc generation and browser to use "ids" instead of "names" for routes and generated files.
286
+ - Currently, "ids" are generated using dashes instead of double colons (instead of random ids). This closes issue #31.
287
+ - Added the definition and handling of canonical urls for API resources
288
+ - One can now specify which action URL should be considered as the canonical resource href:
289
+ - by using `canonical_path <action_name>` at the top of the resource definition class
290
+ - See the [instances](https://github.com/rightscale/praxis/blob/master/spec/spec_app/design/resources/instances.rb) resource definition for an example.
291
+ - With a canonical href defined, one can then both generate and parse them by using:
292
+ - `.to_href(<named arguments hash>) => <href String>`
293
+ - `.parse_href( <href String> ) => < named arguments hash >`. Note: The returned arguments are properly typed-coerced.
294
+ - These helpers can be accessed from:
295
+ - the `definition` object in the controller instance (i.e., `self.definition.to_href(id: 1). )
296
+ - or through the class-level methods in the resource definition (i.e. `MyApiResource.parse_href("/my_resource/1")` )
297
+ - Hooked up rake tasks into the `praxis` binary for convenience. In particular
298
+ - praxis routes [json]
299
+ - praxis docs [browser]
300
+ - praxis console
301
+ - Added `MediaTypeCommon` module, which contains the `identifier`, `description`, and `describe` methods formerly found in `MediaType`. This is now the module used for checking whether a given class should be included in generated documentation, or is valid for use in a `ResponseDefinition`
302
+ - Improved `Praxis::Collection.of` when used with MediaTypes
303
+ - It will now define an inner `<media_type>::Collection` type that is an `Attributor::Collection` of the MediaType that also will include the `MediaTypeCommon` module.
304
+ - By default, Praxis will take the identifier of the parent `MediaType` and append a `collection=true` suffix to it.
305
+ - Fixed `ResponseDefinition` Content-Type validation to properly handle parameters (i.e., "application/json;collection=true").
306
+ - Note: For "index" type actions, this now means Praxis will properly validate any 'collection=true' parameter specified in the `ResponseDefintion` and set by the controller.
307
+ - Deprecated `MediaTypeCollection`. Please define separate classes and attributes for "collection" and "summary" uses.
308
+ - Improved code for stages
309
+ - `setup!` is no longer called within the `run` default code of a stage
310
+ - removed unnecessary raise error when substages are empty (while not common it can be possible, and totally valid)
311
+ - Add `Response` to supported classes in `PluginConcern`
312
+ - Fix doc generation to use `ids` for top-level types (rather than names) so they are correctly linkable.
313
+ - Doc Browser: Added support for Markdown rendering of descriptions (for resources, media_types, attributes, etc...)
314
+ - Added test framework for the doc browser. Run the tests with `grunt test` from lib/api_browser.
315
+ - Enhanced the `praxis:docs:preview` rake task with an optional port parameter
316
+ - Fixed praxis:routes rake task to support actions that do not have routes defined
317
+ - Added `:source` to `ActionDefinition` parameter descriptions with the value of either 'url' or 'query' to denote where the parameter is (typically) extracted from. Note: not currently shown in doc browser.
308
318
 
309
319
  ## 0.13.0
310
- * Added `nodoc!` method to `ActionDefinition`, `ResourceDefinition` to hide actions and resources from the generated documentation.
311
- * Default HTTP responses:
312
- * Added descriptions
313
- * Added 408 RequestTimeout response
314
- * Replaced Ruport dependency in `praxis:routes` rake task with TerminalTable.
315
- * Fixed doc browser issue when attributes defaulting to false wouldn't display the default section.
316
- * Enhanced several logging aspects of the PraxisMapper plugin:
317
- * The log-level of the stats is now configurable in the plugin (see the comments [here](https://github.com/rightscale/praxis/blob/master/lib/praxis/plugins/praxis_mapper_plugin.rb) for details)
318
- * Added a "silence_mapper_stats" attribute in the Request objects so, actions and/or controllers can selectively skip logging stats (for example, health check controllers, etc)
319
- * It now logs a compact message (with the same heading) when the identity map has had no interactions.
320
- * Added X-Cascade header support
321
- * Configured with boolean `praxis.x_cascade` that defaults to true.
322
- * When enabled, Praxis will add an 'X-Cascade: pass' header to the response when the request was not routable to an action. It is not added if the action explicitly returns a `NotFound` response.
323
- * Fixed bug in request handling where `after` callbacks were being executed, even if the stage returned a response.
324
- * Added a handy option to tie an action route to match any HTTP verb.
325
- * Simply use `any` as the verb when you define it (i.e. any '/things/:id' )
326
- * Allow a MediaType to define a custom `links` attribute like any other.
327
- * This is not compatible if it also wants to use the `links` DSL.
328
-
329
320
 
321
+ - Added `nodoc!` method to `ActionDefinition`, `ResourceDefinition` to hide actions and resources from the generated documentation.
322
+ - Default HTTP responses:
323
+ - Added descriptions
324
+ - Added 408 RequestTimeout response
325
+ - Replaced Ruport dependency in `praxis:routes` rake task with TerminalTable.
326
+ - Fixed doc browser issue when attributes defaulting to false wouldn't display the default section.
327
+ - Enhanced several logging aspects of the PraxisMapper plugin:
328
+ - The log-level of the stats is now configurable in the plugin (see the comments [here](https://github.com/rightscale/praxis/blob/master/lib/praxis/plugins/praxis_mapper_plugin.rb) for details)
329
+ - Added a "silence_mapper_stats" attribute in the Request objects so, actions and/or controllers can selectively skip logging stats (for example, health check controllers, etc)
330
+ - It now logs a compact message (with the same heading) when the identity map has had no interactions.
331
+ - Added X-Cascade header support
332
+ - Configured with boolean `praxis.x_cascade` that defaults to true.
333
+ - When enabled, Praxis will add an 'X-Cascade: pass' header to the response when the request was not routable to an action. It is not added if the action explicitly returns a `NotFound` response.
334
+ - Fixed bug in request handling where `after` callbacks were being executed, even if the stage returned a response.
335
+ - Added a handy option to tie an action route to match any HTTP verb.
336
+ - Simply use `any` as the verb when you define it (i.e. any '/things/:id' )
337
+ - Allow a MediaType to define a custom `links` attribute like any other.
338
+ - This is not compatible if it also wants to use the `links` DSL.
330
339
 
331
340
  ## 0.11.2
332
341
 
333
- * The Doc Browser will now not change the menu when refreshing.
334
- * Fixes an issue where URLs in the doc browser would display JSON.
335
- * Fixes an issue where table columns in the doc browser would be overlapping.
336
- * Refactor Praxis Mapper plugin to be more generic.
337
- * Update attributor dependency to 2.4.0
342
+ - The Doc Browser will now not change the menu when refreshing.
343
+ - Fixes an issue where URLs in the doc browser would display JSON.
344
+ - Fixes an issue where table columns in the doc browser would be overlapping.
345
+ - Refactor Praxis Mapper plugin to be more generic.
346
+ - Update attributor dependency to 2.4.0
338
347
 
339
348
  ## 0.11.1
340
349
 
341
- * Fix `Stats` plugin to handle empty `args` hashes.
350
+ - Fix `Stats` plugin to handle empty `args` hashes.
342
351
 
343
352
  ## 0.11
344
353
 
345
- * `MediaTypeCollection`:
346
- * Added support for loading `decorate`ed `Resource` associations.
347
- * Refined and enhanced support for API versioning:
348
- * version DSL now can take a `using` option which specifies and array of the methods are allowed: `:header`,`:params`,`:path`(new)
349
- * if not specified, it will default to `using: [:header, :params]` (so that the version can be passed to the header OR the params)
350
- * the new `:path` option will build the action routes by prefixing the version given a common pattern (i.e., "/v1.0/...")
351
- * The effects of path versioning will be visible through `rake praxis:routes`
352
- * the default api prefix pattern is ("/v(version)/") but can changed by either
353
- * overriding ``Praxis::Request.path_version_prefix` and return the appropriate string prefix (i.e., by default this returns "/v")
354
- * or overriding `Praxis::Request.path_version_matcher` and providing the fully custom matching regexp. This regexp must have a capture (named `version`) that would return matched version value.
355
- * Enhanced praxis generator:
356
- * Added a new generator (available through `praxis new app_name`) which creates a blank new app, with enough basic structure and setup to start building an API.
357
- * Changed the example hello world generation command. Instead of `praxis generate app_name`, it is now available through `praxis example app_name`
358
- * Changed the path lookup for the praxis directory (to not use installed gems, which could be multiple). [Issue #67]
359
- * `ResourceDefinition`:
360
- * Added: `action_defaults` method, to define default options for actions. May be called more than once.
361
- * Removed: `params`, `payload`, `headers`, and `response`. Specify these inside `action_defaults` instead.
362
- * `Application`:
363
- * Added `middleware` method to use Rack middleware.
364
- * `ErrorHandler`
365
- * It is now possible to register the error handler class to be invoked when an uncaught exception is thrown by setting `Application#error_handler`.
366
- * The default error handler writes the error and backtrace into the Praxis logger, and returns an `InternalServerError` response
367
- * Added `Praxis::Notifications` framework backed by ActiveSupport::Notifications
368
- * Its interface is the same as AS::Notifications (.publish, .instrument, .subscribe, and etc.)
369
- * Each incoming rack request is instrumented as `rack.request.all`, with a payload of `{response: response}`, where `response` is the `Response` object that will be returned to the client. Internally, Praxis subscribes to this to generate timing statistics with `Praxis::Stats`.
370
- * Additionally, each request that is dispatched to an action is instrumented as `praxis.request.all`, with a payload of `{request: request, response: response}`, where `response` is as above, and `request` is the `Request` object for the request.
371
- * Added `Praxis::Stats` framework backed by `Harness` (i.e. a statsd interface)
372
- * Can be configured with a collector type (fake, Statsd) and an asynchronous queue + thread
373
- * Wraps the statsd interface: count, increment, decrement, time ...
374
- * Added a new `decorate_docs` method to enhance generated JSON docs for actions in `ResourceDefinitions`
375
- * Using this hook, anybody can register a block that can change/enhance the JSON structure of generated documents for any given action
376
- * Added a brand new Plugins architecture
377
- * Plugins can easily inject code in the Request, Controller, ResourceDefinition or ActionDefinition
378
- * Can be instances or singletons (and will be initialized correspondingly)
379
- * Plugins can be easily configured under a unique "config key" in the Praxis config
380
- * See the [Plugins](http://praxis-framework.io/reference/plugins/) section in the documentation for more information.
381
- * Added a Plugin for using the Praxis::Mapper gem
382
- * Configurable through a simple `praxis_mapper.yml` file
383
- * Its supports several repositories (by name)
384
- * Each repository can be of a different type (default is sequel)
385
- * `praxis:doc_browser` rake task now takes a port argument for specifying the port to run on, e.g. `rake praxis:doc_browser[9000]` to run on port 9000.
386
- * Added `show_exceptions` configuration option to to control default ErrorHandler behavior.
354
+ - `MediaTypeCollection`:
355
+ - Added support for loading `decorate`ed `Resource` associations.
356
+ - Refined and enhanced support for API versioning:
357
+ - version DSL now can take a `using` option which specifies and array of the methods are allowed: `:header`,`:params`,`:path`(new)
358
+ - if not specified, it will default to `using: [:header, :params]` (so that the version can be passed to the header OR the params)
359
+ - the new `:path` option will build the action routes by prefixing the version given a common pattern (i.e., "/v1.0/...")
360
+ - The effects of path versioning will be visible through `rake praxis:routes`
361
+ - the default api prefix pattern is ("/v(version)/") but can changed by either
362
+ - overriding ``Praxis::Request.path_version_prefix` and return the appropriate string prefix (i.e., by default this returns "/v")
363
+ - or overriding `Praxis::Request.path_version_matcher` and providing the fully custom matching regexp. This regexp must have a capture (named `version`) that would return matched version value.
364
+ - Enhanced praxis generator:
365
+ - Added a new generator (available through `praxis new app_name`) which creates a blank new app, with enough basic structure and setup to start building an API.
366
+ - Changed the example hello world generation command. Instead of `praxis generate app_name`, it is now available through `praxis example app_name`
367
+ - Changed the path lookup for the praxis directory (to not use installed gems, which could be multiple). [Issue #67]
368
+ - `ResourceDefinition`:
369
+ - Added: `action_defaults` method, to define default options for actions. May be called more than once.
370
+ - Removed: `params`, `payload`, `headers`, and `response`. Specify these inside `action_defaults` instead.
371
+ - `Application`:
372
+ - Added `middleware` method to use Rack middleware.
373
+ - `ErrorHandler`
374
+ - It is now possible to register the error handler class to be invoked when an uncaught exception is thrown by setting `Application#error_handler`.
375
+ - The default error handler writes the error and backtrace into the Praxis logger, and returns an `InternalServerError` response
376
+ - Added `Praxis::Notifications` framework backed by ActiveSupport::Notifications
377
+ - Its interface is the same as AS::Notifications (.publish, .instrument, .subscribe, and etc.)
378
+ - Each incoming rack request is instrumented as `rack.request.all`, with a payload of `{response: response}`, where `response` is the `Response` object that will be returned to the client. Internally, Praxis subscribes to this to generate timing statistics with `Praxis::Stats`.
379
+ - Additionally, each request that is dispatched to an action is instrumented as `praxis.request.all`, with a payload of `{request: request, response: response}`, where `response` is as above, and `request` is the `Request` object for the request.
380
+ - Added `Praxis::Stats` framework backed by `Harness` (i.e. a statsd interface)
381
+ - Can be configured with a collector type (fake, Statsd) and an asynchronous queue + thread
382
+ - Wraps the statsd interface: count, increment, decrement, time ...
383
+ - Added a new `decorate_docs` method to enhance generated JSON docs for actions in `ResourceDefinitions`
384
+ - Using this hook, anybody can register a block that can change/enhance the JSON structure of generated documents for any given action
385
+ - Added a brand new Plugins architecture
386
+ - Plugins can easily inject code in the Request, Controller, ResourceDefinition or ActionDefinition
387
+ - Can be instances or singletons (and will be initialized correspondingly)
388
+ - Plugins can be easily configured under a unique "config key" in the Praxis config
389
+ - See the [Plugins](http://praxis-framework.io/reference/plugins/) section in the documentation for more information.
390
+ - Added a Plugin for using the Praxis::Mapper gem
391
+ - Configurable through a simple `praxis_mapper.yml` file
392
+ - Its supports several repositories (by name)
393
+ - Each repository can be of a different type (default is sequel)
394
+ - `praxis:doc_browser` rake task now takes a port argument for specifying the port to run on, e.g. `rake praxis:doc_browser[9000]` to run on port 9000.
395
+ - Added `show_exceptions` configuration option to to control default ErrorHandler behavior.
387
396
 
388
397
  ## 0.10.0
389
398
 
390
- * Avoid loading responses (and templates) lazily as they need to be registered in time
391
- * Fix: app generator's handling of 404. [@magneland](https://github.com/magneland) [Issue #10](https://github.com/rightscale/praxis/issues/10)
392
- * Fix: Getting started doc. [@WilliamSnyders](https://github.com/WilliamSnyders) [Issue #19](https://github.com/rightscale/praxis/issues/19)
393
- * Controller filters can now shortcut the request lifecycle flow by returning a `Response`:
394
- * If a before filter returns it, both the action and the after filters will be skipped (as well as any remaining filters in the before list)
395
- * If an after filter returns it, any remaining after filters in the block will be skipped.
396
- * There is no way for the action result to skip the :after filters.
397
- * Refactored Controller module to properly used ActiveSupprt concerns. [@jasonayre](https://github.com/jasonayre) [Issue #26](https://github.com/rightscale/praxis/issues/26)
398
- * Separated the controller module into a Controller concern and a separable Callbacks concern
399
- * Controller filters (i.e. callbacks) can shortcut request lifecycle by returning a Response object:
400
- * If a before filter returns it, both the action and the after filters will be skipped (as well as any remaining before filters)
401
- * If an after filter returns it, any remaining after filters in the block will be skipped.
402
- * There is no way for the action result to skip the :after filters.
403
- * Fixes [Issue #21](https://github.com/rightscale/praxis/issues/21)
404
- * Introduced `around` filters using blocks:
405
- * Around filters can be set wrapping any of the request stages (load, validate, action...) and might apply to only certain actions (i.e. exactly the same as the before/after filters)
406
- * Therefore they supports the same attributes as `before` and `after` filters. The only difference is that an around filter block will get an extra parameter with the block to call to continue the chain.
407
- * See the [Instances](https://github.com/rightscale/praxis/blob/master/spec/spec_app/app/controllers/instances.rb) controller for examples.
408
- * Fix: Change :created response template to take an optiona ‘location’ parameter (instead of a media_type one, since it doesn’t make sense for a 201 type response) [Issue #26](https://github.com/rightscale/praxis/issues/23)
409
- * Make the system be more robust in error reporting when controllers do not return a String or a Response
410
- * Fix: ValidationError not setting a Content-Type header. [Issue #39](https://github.com/rightscale/praxis/issues/19)
411
- * Relaxed ActiveSupport version dependency (from 4 to >=3 )
412
- * Fix: InternalServerError not setting a Content-Type header. [Issue #42](https://github.com/rightscale/praxis/issues/42)
413
- * A few document browser improvements:
414
- * Avoid showing certain internal type options (i.e. reference).
415
- * Fixed type label cide to detect collections better, and differentiate between Attributor ones and MediaType ones.
416
- * Tweaked _example.html template to be much more collapsed by default, as it is not great, but makes it easier to review.
417
- * Enhanced _links.html template to use the rs-type-label, and rs-attribute-description directives.
418
- * Small design improvements on the home page for showing routes and verbs more prominently.
419
- * Mediatype documentation improvements:
420
- * Make `Links` always list its attributes when describe (never shallow)
421
- * refactored MediaTypeCollection to store a member_attribute (instead of a member_type), and report it in describe much like attributor collections do.
422
- * `MediaTypeCollection`. See [volume_snapshot](spec/spec_app/design/media_types/volume_snapshot.rb) in the specs for an example.
423
- * Added `member_view` DSL to define a view that renders the collection's members with the given view.
424
- * Change: Now requires all views to be explicitly defined (and will not automatically use the underlying member view if it exists). To define a view for member element (wrapping it in a collection) one can use the new member_view.
425
- *
426
-
399
+ - Avoid loading responses (and templates) lazily as they need to be registered in time
400
+ - Fix: app generator's handling of 404. [@magneland](https://github.com/magneland) [Issue #10](https://github.com/rightscale/praxis/issues/10)
401
+ - Fix: Getting started doc. [@WilliamSnyders](https://github.com/WilliamSnyders) [Issue #19](https://github.com/rightscale/praxis/issues/19)
402
+ - Controller filters can now shortcut the request lifecycle flow by returning a `Response`:
403
+ - If a before filter returns it, both the action and the after filters will be skipped (as well as any remaining filters in the before list)
404
+ - If an after filter returns it, any remaining after filters in the block will be skipped.
405
+ - There is no way for the action result to skip the :after filters.
406
+ - Refactored Controller module to properly used ActiveSupprt concerns. [@jasonayre](https://github.com/jasonayre) [Issue #26](https://github.com/rightscale/praxis/issues/26)
407
+ - Separated the controller module into a Controller concern and a separable Callbacks concern
408
+ - Controller filters (i.e. callbacks) can shortcut request lifecycle by returning a Response object:
409
+ - If a before filter returns it, both the action and the after filters will be skipped (as well as any remaining before filters)
410
+ - If an after filter returns it, any remaining after filters in the block will be skipped.
411
+ - There is no way for the action result to skip the :after filters.
412
+ - Fixes [Issue #21](https://github.com/rightscale/praxis/issues/21)
413
+ - Introduced `around` filters using blocks: \* Around filters can be set wrapping any of the request stages (load, validate, action...) and might apply to only certain actions (i.e. exactly the same as the before/after filters)
414
+ - Therefore they supports the same attributes as `before` and `after` filters. The only difference is that an around filter block will get an extra parameter with the block to call to continue the chain. \* See the [Instances](https://github.com/rightscale/praxis/blob/master/spec/spec_app/app/controllers/instances.rb) controller for examples.
415
+ - Fix: Change :created response template to take an optiona ‘location’ parameter (instead of a media_type one, since it doesn’t make sense for a 201 type response) [Issue #26](https://github.com/rightscale/praxis/issues/23)
416
+ - Make the system be more robust in error reporting when controllers do not return a String or a Response
417
+ - Fix: ValidationError not setting a Content-Type header. [Issue #39](https://github.com/rightscale/praxis/issues/19)
418
+ - Relaxed ActiveSupport version dependency (from 4 to >=3 )
419
+ - Fix: InternalServerError not setting a Content-Type header. [Issue #42](https://github.com/rightscale/praxis/issues/42)
420
+ - A few document browser improvements:
421
+ _ Avoid showing certain internal type options (i.e. reference).
422
+ _ Fixed type label cide to detect collections better, and differentiate between Attributor ones and MediaType ones.
423
+ _ Tweaked \_example.html template to be much more collapsed by default, as it is not great, but makes it easier to review.
424
+ _ Enhanced \_links.html template to use the rs-type-label, and rs-attribute-description directives. \* Small design improvements on the home page for showing routes and verbs more prominently.
425
+ - Mediatype documentation improvements:
426
+ _ Make `Links` always list its attributes when describe (never shallow)
427
+ _ refactored MediaTypeCollection to store a member_attribute (instead of a member_type), and report it in describe much like attributor collections do.
428
+ - `MediaTypeCollection`. See [volume_snapshot](spec/spec_app/design/media_types/volume_snapshot.rb) in the specs for an example.
429
+ - Added `member_view` DSL to define a view that renders the collection's members with the given view.
430
+ - Change: Now requires all views to be explicitly defined (and will not automatically use the underlying member view if it exists). To define a view for member element (wrapping it in a collection) one can use the new member_view.
431
+ -
427
432
 
428
433
  ## 0.9 Initial release