praxis 0.20.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/api_browser/app/js/directives/request_examples.js +3 -1
- data/lib/api_browser/app/js/directives/url.js +2 -3
- data/lib/praxis/api_definition.rb +2 -1
- data/lib/praxis/docs/generator.rb +5 -2
- data/lib/praxis/simple_media_type.rb +7 -1
- data/lib/praxis/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cc6641a8ee79fff261135fc27c46987c5118963
|
4
|
+
data.tar.gz: 23e6e0f445620738409e10818044f66f923c940a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f956167d5bf702c127b12b632a1b4d7ac3a404088d9f1fc226c813ffcd5bb93d4c857747bcd24acd07f449fb4123240e768716c0f433182588fd33d85143682
|
7
|
+
data.tar.gz: 956e4d47a1b7fecdb9f41da2343422f1f243b777b64402fccd9fd3c2e92a0b878b2c907f7c79d39b7d38b1a81f2a8a7564fc5f80ad43acce3144d778c46c6b6f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
## next
|
4
4
|
|
5
|
+
## 0.20.1
|
6
|
+
|
7
|
+
* Doc generation: handle SimpleMediaTypes so that they don’t show up in the generated schemas.
|
8
|
+
* Ensure we require AS#Enumerable extension is loaded, which is required in the generator code.
|
9
|
+
* Add Date to the list of primitive types so that it does not show in the generated schemas.
|
10
|
+
* Enhance the `:created` response_template, so that it can take the associated media_type
|
11
|
+
* Doc Browser: fix route display to have the captures instead of the example
|
12
|
+
|
5
13
|
## 0.20.0
|
6
14
|
|
7
15
|
* You can now add a `bower.json` file to your `docs` folder. Any dependencies
|
@@ -12,7 +12,9 @@ app.directive('requestExamples', function(Examples, $timeout) {
|
|
12
12
|
var keys = _.keys(scope.examples);
|
13
13
|
if (keys.length === 1) {
|
14
14
|
scope.examples[keys[0]].template.then(function(templateFn) {
|
15
|
-
|
15
|
+
$timeout(function() {
|
16
|
+
element.empty().append(templateFn(scope));
|
17
|
+
}, 100);
|
16
18
|
});
|
17
19
|
} else {
|
18
20
|
scope.select = function(template) {
|
@@ -5,12 +5,11 @@ app.directive('url', function() {
|
|
5
5
|
return {
|
6
6
|
restrict: 'EA',
|
7
7
|
scope: {
|
8
|
-
action: '='
|
9
|
-
example: '@'
|
8
|
+
action: '='
|
10
9
|
},
|
11
10
|
templateUrl: 'views/directives/url.html',
|
12
11
|
link: function(scope, element, attrs) {
|
13
|
-
scope.showExample =
|
12
|
+
scope.showExample = 'example' in attrs;
|
14
13
|
}
|
15
14
|
};
|
16
15
|
});
|
@@ -98,7 +98,8 @@ module Praxis
|
|
98
98
|
description 'Standard response for successful HTTP requests.'
|
99
99
|
end
|
100
100
|
|
101
|
-
api.response_template :created do |location: nil|
|
101
|
+
api.response_template :created do |location: nil, media_type: nil|
|
102
|
+
media_type media_type if media_type
|
102
103
|
location location
|
103
104
|
status 201
|
104
105
|
description 'The request has been fulfilled and resulted in a new resource being created.'
|
@@ -2,6 +2,8 @@ module Praxis
|
|
2
2
|
module Docs
|
3
3
|
|
4
4
|
class Generator
|
5
|
+
require 'active_support/core_ext/enumerable' # For index_by
|
6
|
+
|
5
7
|
API_DOCS_DIRNAME = 'docs/api'
|
6
8
|
|
7
9
|
attr_reader :resources_by_version, :types_by_id, :infos_by_version
|
@@ -11,6 +13,7 @@ module Praxis
|
|
11
13
|
Attributor::Boolean,
|
12
14
|
Attributor::CSV,
|
13
15
|
Attributor::DateTime,
|
16
|
+
Attributor::Date,
|
14
17
|
Attributor::Float,
|
15
18
|
Attributor::Hash,
|
16
19
|
Attributor::Ids,
|
@@ -85,9 +88,9 @@ module Praxis
|
|
85
88
|
when Hash
|
86
89
|
if data.key?(:type) && data[:type].kind_of?(Hash) && ( [:id,:name,:family] - data[:type].keys ).empty?
|
87
90
|
type_id = data[:type][:id]
|
88
|
-
unless type_id.nil?
|
91
|
+
unless type_id.nil? || type_id == Praxis::SimpleMediaType.id #SimpleTypes shouldn't be collected
|
89
92
|
unless types_by_id[type_id]
|
90
|
-
raise "Error! We have detected a reference to a 'Type' which is not derived from Attributor::Type" +
|
93
|
+
raise "Error! We have detected a reference to a 'Type' with id='#{type_id}' which is not derived from Attributor::Type" +
|
91
94
|
" Document generation cannot proceed."
|
92
95
|
end
|
93
96
|
reachable_types << types_by_id[type_id]
|
@@ -6,14 +6,20 @@ module Praxis
|
|
6
6
|
# @see Praxis::MediaType
|
7
7
|
# @see Praxis::Types::MediaTypeCommon
|
8
8
|
SimpleMediaType = Struct.new(:identifier) do
|
9
|
+
|
9
10
|
def name
|
10
11
|
self.class.name
|
11
12
|
end
|
12
13
|
|
14
|
+
def self.id
|
15
|
+
"Praxis-SimpleMediaType".freeze
|
16
|
+
end
|
17
|
+
|
13
18
|
def id
|
14
|
-
self.class.
|
19
|
+
self.class.id
|
15
20
|
end
|
16
21
|
|
22
|
+
|
17
23
|
def describe(shallow=true)
|
18
24
|
{name: name, family: "string", id: id, identifier: identifier}
|
19
25
|
end
|
data/lib/praxis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: praxis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep M. Blanquer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -725,7 +725,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
725
725
|
version: '0'
|
726
726
|
requirements: []
|
727
727
|
rubyforge_project:
|
728
|
-
rubygems_version: 2.4.5
|
728
|
+
rubygems_version: 2.4.5.1
|
729
729
|
signing_key:
|
730
730
|
specification_version: 4
|
731
731
|
summary: Building APIs the way you want it.
|