Praxis v0.16.0 Release Notes
-
- Overhauled traits: they're now represented by a
Trait
class, which are created fromApiDefinition#trait
.ApiDefinition#describe
will also include details of the defined traits.ResourceDefinition#describe
andActionDefinition#describe
will also include the names of the used traits.- 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.
- ๐ Deprecated
ResourceDefinition.routing
. UseResourceDefinition.prefix
to define resource-level route prefixes instead. - ๐จ Significantly refactored route generation.
- The
base_path
property defined inApiDefinition#info
will now appear in the routing paths 'base' (instead of simply being used for documentation purposes). 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. - Any prefixes set on a
ResourceDefinition
or inside arouting
block of an ActionDefinition are now additive. For example: - 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...".
- Prefixes can be equally set by including
Traits
, which will follow exactly the same additive rules. - To break the additive nature of the prefixes one can use a couple of different options:
- Define the action route path with "//" to make it absolute, i.e. a path like "//people" would not include any defined prefix.
- Explicitly clear the prefix by setting the prefix to
''
or'//'
.
- The
- โ Added
base_params
toApiDefinition#info
as a way to share common action paramsbase_params
may be defined for a specific Api version, which will make sharing params across all Resource definitions of that version)- 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.
- ๐ Fixed
MediaType#describe
to include the correct string representation of its identifier. - ๐ Allow route options to be passed to the underlying router (i.e. Mustermann at the moment)
- 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! - Displaying routes (
praxis routes
orrake praxis:routes
) will now include any options defined in a route. - 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).
- routes defined in the
- โ
Spruced up the example app (generator) to use the latest
prefix
andtrait
changes
- Overhauled traits: they're now represented by a