riddl 0.101.10 → 0.101.16
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/lib/ruby/riddl/handlers/relaxng.rb +15 -10
- data/lib/ruby/riddl/ns/common-patterns/notifications-producer/2.0/producer.xml +177 -0
- data/lib/ruby/riddl/server.rb +9 -0
- data/lib/ruby/riddl/utils/properties.rb +1 -1
- data/lib/ruby/riddl/wrapper/messageparser.rb +2 -1
- data/ns/common-patterns/notifications-producer/2.0/producer.xml +177 -0
- data/riddl.gemspec +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75b27043581e0e50dc78a98091f62e4da7e2543dd9a4a7c48df7468b341247fc
|
4
|
+
data.tar.gz: 5287797068c18f3201971128ff00d73883870bd639137afe574ffe9ff47dce7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9903c8acfcd47ca16a2506c9eae4435bd994a2694e3af6fd2cc2337913be1f411d9a315a86b2948fc9f482a458617af7c0765fd3fe3537557789f4f53761de
|
7
|
+
data.tar.gz: 992f143f5064d8d7ecfc87ffb32b04f8f74b0013f5033d8cc4e1246f216d753341de408f9fa72ab3a83a28e2c9b3fe7022092b0ce9a0a3ddc41d661b54e768b0
|
@@ -2,17 +2,22 @@ module Riddl
|
|
2
2
|
module Handlers
|
3
3
|
class RelaxNG < Riddl::Handlers::Implementation
|
4
4
|
def self::handle(what,hinfo)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
begin
|
6
|
+
w = if what.class == Riddl::Parameter::Tempfile || what.class == File
|
7
|
+
XML::Smart.open_unprotected(what)
|
8
|
+
else
|
9
|
+
XML::Smart.string(what)
|
10
|
+
end
|
11
|
+
rng = XML::Smart.string("<payload>" + hinfo + "</payload>")
|
12
|
+
rng.register_namespace 'r', 'http://relaxng.org/ns/structure/1.0'
|
13
|
+
w.validate_against(rng.find("//r:grammar|//r:element").first.to_doc) rescue false
|
14
|
+
rescue
|
15
|
+
puts 'The XML sent to the server is b0rked/>'
|
16
|
+
false
|
17
|
+
end
|
13
18
|
end
|
14
19
|
end
|
15
|
-
end
|
16
|
-
end
|
20
|
+
end
|
21
|
+
end
|
17
22
|
|
18
23
|
Riddl::Handlers::add("http://riddl.org/ns/handlers/relaxng",Riddl::Handlers::RelaxNG)
|
@@ -0,0 +1,177 @@
|
|
1
|
+
<description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
|
2
|
+
|
3
|
+
<message name="topics">
|
4
|
+
<parameter name="topics" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
5
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
6
|
+
<start>
|
7
|
+
<element name="topics">
|
8
|
+
<zeroOrMore>
|
9
|
+
<ref name="topic"/>
|
10
|
+
</zeroOrMore>
|
11
|
+
</element>
|
12
|
+
</start>
|
13
|
+
|
14
|
+
<define name="topic">
|
15
|
+
<element name="topic">
|
16
|
+
<attribute name="id">
|
17
|
+
<data type="string"/>
|
18
|
+
</attribute>
|
19
|
+
<zeroOrMore>
|
20
|
+
<element>
|
21
|
+
<choice>
|
22
|
+
<name>event</name>
|
23
|
+
<name>vote</name>
|
24
|
+
</choice>
|
25
|
+
<data type="string">
|
26
|
+
<param name="pattern">[\w-_]+</param>
|
27
|
+
</data>
|
28
|
+
</element>
|
29
|
+
</zeroOrMore>
|
30
|
+
</element>
|
31
|
+
</define>
|
32
|
+
|
33
|
+
</grammar>
|
34
|
+
</parameter>
|
35
|
+
</message>
|
36
|
+
|
37
|
+
<message name="subscriptions">
|
38
|
+
<parameter name="subscriptions" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
39
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
40
|
+
<start>
|
41
|
+
<element name="subscriptions">
|
42
|
+
<zeroOrMore>
|
43
|
+
<ref name="subscription"/>
|
44
|
+
</zeroOrMore>
|
45
|
+
</element>
|
46
|
+
</start>
|
47
|
+
|
48
|
+
<define name="subscription">
|
49
|
+
<element name="subscription">
|
50
|
+
<attribute name="id">
|
51
|
+
<data type="string"/>
|
52
|
+
</attribute>
|
53
|
+
<optional>
|
54
|
+
<attribute name="url">
|
55
|
+
<data type="string"/>
|
56
|
+
</attribute>
|
57
|
+
</optional>
|
58
|
+
</element>
|
59
|
+
</define>
|
60
|
+
|
61
|
+
</grammar>
|
62
|
+
</parameter>
|
63
|
+
</message>
|
64
|
+
|
65
|
+
<message name="subscription">
|
66
|
+
<parameter name="subscription" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
67
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
68
|
+
<start>
|
69
|
+
<element name="subscription">
|
70
|
+
<optional>
|
71
|
+
<attribute name="url">
|
72
|
+
<data type="string"/>
|
73
|
+
</attribute>
|
74
|
+
</optional>
|
75
|
+
<oneOrMore>
|
76
|
+
<element name="topic">
|
77
|
+
<attribute name="id">
|
78
|
+
<data type="string"/>
|
79
|
+
</attribute>
|
80
|
+
<oneOrMore>
|
81
|
+
<element>
|
82
|
+
<choice>
|
83
|
+
<name>event</name>
|
84
|
+
<name>vote</name>
|
85
|
+
</choice>
|
86
|
+
<data type="string">
|
87
|
+
<param name="pattern">[\w_]+</param>
|
88
|
+
</data>
|
89
|
+
</element>
|
90
|
+
</oneOrMore>
|
91
|
+
</element>
|
92
|
+
</oneOrMore>
|
93
|
+
</element>
|
94
|
+
</start>
|
95
|
+
</grammar>
|
96
|
+
</parameter>
|
97
|
+
</message>
|
98
|
+
|
99
|
+
<message name="subscribe">
|
100
|
+
<optional>
|
101
|
+
<parameter name="url" type="string"/>
|
102
|
+
<optional>
|
103
|
+
<parameter name="onbehalf" type="string"/>
|
104
|
+
</optional>
|
105
|
+
</optional>
|
106
|
+
<oneOrMore>
|
107
|
+
<parameter name="topic" type="string"/>
|
108
|
+
<choice>
|
109
|
+
<parameter name="votes" type="string">
|
110
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
111
|
+
</parameter>
|
112
|
+
<parameter name="events" type="string">
|
113
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
114
|
+
</parameter>
|
115
|
+
</choice>
|
116
|
+
</oneOrMore>
|
117
|
+
</message>
|
118
|
+
<message name="acknowledgment">
|
119
|
+
<parameter name="key" type="string"/>
|
120
|
+
</message>
|
121
|
+
|
122
|
+
<message name="details">
|
123
|
+
<optional>
|
124
|
+
<parameter name="url" type="string"/>
|
125
|
+
</optional>
|
126
|
+
<oneOrMore>
|
127
|
+
<parameter name="topic" type="string"/>
|
128
|
+
<choice>
|
129
|
+
<parameter name="votes" type="string">
|
130
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
131
|
+
</parameter>
|
132
|
+
<parameter name="events" type="string">
|
133
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
134
|
+
</parameter>
|
135
|
+
</choice>
|
136
|
+
</oneOrMore>
|
137
|
+
</message>
|
138
|
+
|
139
|
+
<message name="overview">
|
140
|
+
<parameter name="overview" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
141
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
142
|
+
<start>
|
143
|
+
<element name="overview">
|
144
|
+
<element name="topics">
|
145
|
+
<empty/>
|
146
|
+
</element>
|
147
|
+
<element name="subscriptions">
|
148
|
+
<empty/>
|
149
|
+
</element>
|
150
|
+
</element>
|
151
|
+
</start>
|
152
|
+
</grammar>
|
153
|
+
</parameter>
|
154
|
+
</message>
|
155
|
+
|
156
|
+
<resource pattern="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
157
|
+
<resource relative="notifications">
|
158
|
+
<get in="*" out="overview"/>
|
159
|
+
<resource relative="topics">
|
160
|
+
<get in="*" out="topics"/>
|
161
|
+
</resource>
|
162
|
+
<resource relative="subscriptions">
|
163
|
+
<get in="*" out="subscriptions"/>
|
164
|
+
<post in="subscribe" out="acknowledgment"/>
|
165
|
+
<resource>
|
166
|
+
<get out="subscription"/>
|
167
|
+
<put in="details"/>
|
168
|
+
<delete/>
|
169
|
+
<resource relative="sse">
|
170
|
+
<sse/>
|
171
|
+
</resource>
|
172
|
+
</resource>
|
173
|
+
</resource>
|
174
|
+
</resource>
|
175
|
+
</resource>
|
176
|
+
|
177
|
+
</description>
|
data/lib/ruby/riddl/server.rb
CHANGED
@@ -134,6 +134,11 @@ module Riddl
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
+
if @riddl_opts[:parallel]
|
138
|
+
EM.defer do
|
139
|
+
@riddl_opts[:parallel].call
|
140
|
+
end
|
141
|
+
end
|
137
142
|
end
|
138
143
|
|
139
144
|
rescue => e
|
@@ -144,6 +149,10 @@ module Riddl
|
|
144
149
|
end
|
145
150
|
end #}}}
|
146
151
|
|
152
|
+
def parallel(&blk)
|
153
|
+
@riddl_opts[:parallel] = blk
|
154
|
+
end
|
155
|
+
|
147
156
|
def call(env)# {{{
|
148
157
|
dup.__http_call(env)
|
149
158
|
end# }}}
|
@@ -201,7 +201,8 @@ module Riddl
|
|
201
201
|
end
|
202
202
|
a.children.each do |e|
|
203
203
|
unless e.class == XML::Smart::Dom::Text
|
204
|
-
e
|
204
|
+
e = e.to_doc.root
|
205
|
+
e.namespaces[nil] = 'http://relaxng.org/ns/structure/1.0'
|
205
206
|
data.add e
|
206
207
|
end
|
207
208
|
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
<description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
|
2
|
+
|
3
|
+
<message name="topics">
|
4
|
+
<parameter name="topics" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
5
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
6
|
+
<start>
|
7
|
+
<element name="topics">
|
8
|
+
<zeroOrMore>
|
9
|
+
<ref name="topic"/>
|
10
|
+
</zeroOrMore>
|
11
|
+
</element>
|
12
|
+
</start>
|
13
|
+
|
14
|
+
<define name="topic">
|
15
|
+
<element name="topic">
|
16
|
+
<attribute name="id">
|
17
|
+
<data type="string"/>
|
18
|
+
</attribute>
|
19
|
+
<zeroOrMore>
|
20
|
+
<element>
|
21
|
+
<choice>
|
22
|
+
<name>event</name>
|
23
|
+
<name>vote</name>
|
24
|
+
</choice>
|
25
|
+
<data type="string">
|
26
|
+
<param name="pattern">[\w-_]+</param>
|
27
|
+
</data>
|
28
|
+
</element>
|
29
|
+
</zeroOrMore>
|
30
|
+
</element>
|
31
|
+
</define>
|
32
|
+
|
33
|
+
</grammar>
|
34
|
+
</parameter>
|
35
|
+
</message>
|
36
|
+
|
37
|
+
<message name="subscriptions">
|
38
|
+
<parameter name="subscriptions" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
39
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
40
|
+
<start>
|
41
|
+
<element name="subscriptions">
|
42
|
+
<zeroOrMore>
|
43
|
+
<ref name="subscription"/>
|
44
|
+
</zeroOrMore>
|
45
|
+
</element>
|
46
|
+
</start>
|
47
|
+
|
48
|
+
<define name="subscription">
|
49
|
+
<element name="subscription">
|
50
|
+
<attribute name="id">
|
51
|
+
<data type="string"/>
|
52
|
+
</attribute>
|
53
|
+
<optional>
|
54
|
+
<attribute name="url">
|
55
|
+
<data type="string"/>
|
56
|
+
</attribute>
|
57
|
+
</optional>
|
58
|
+
</element>
|
59
|
+
</define>
|
60
|
+
|
61
|
+
</grammar>
|
62
|
+
</parameter>
|
63
|
+
</message>
|
64
|
+
|
65
|
+
<message name="subscription">
|
66
|
+
<parameter name="subscription" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
67
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
68
|
+
<start>
|
69
|
+
<element name="subscription">
|
70
|
+
<optional>
|
71
|
+
<attribute name="url">
|
72
|
+
<data type="string"/>
|
73
|
+
</attribute>
|
74
|
+
</optional>
|
75
|
+
<oneOrMore>
|
76
|
+
<element name="topic">
|
77
|
+
<attribute name="id">
|
78
|
+
<data type="string"/>
|
79
|
+
</attribute>
|
80
|
+
<oneOrMore>
|
81
|
+
<element>
|
82
|
+
<choice>
|
83
|
+
<name>event</name>
|
84
|
+
<name>vote</name>
|
85
|
+
</choice>
|
86
|
+
<data type="string">
|
87
|
+
<param name="pattern">[\w_]+</param>
|
88
|
+
</data>
|
89
|
+
</element>
|
90
|
+
</oneOrMore>
|
91
|
+
</element>
|
92
|
+
</oneOrMore>
|
93
|
+
</element>
|
94
|
+
</start>
|
95
|
+
</grammar>
|
96
|
+
</parameter>
|
97
|
+
</message>
|
98
|
+
|
99
|
+
<message name="subscribe">
|
100
|
+
<optional>
|
101
|
+
<parameter name="url" type="string"/>
|
102
|
+
<optional>
|
103
|
+
<parameter name="onbehalf" type="string"/>
|
104
|
+
</optional>
|
105
|
+
</optional>
|
106
|
+
<oneOrMore>
|
107
|
+
<parameter name="topic" type="string"/>
|
108
|
+
<choice>
|
109
|
+
<parameter name="votes" type="string">
|
110
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
111
|
+
</parameter>
|
112
|
+
<parameter name="events" type="string">
|
113
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
114
|
+
</parameter>
|
115
|
+
</choice>
|
116
|
+
</oneOrMore>
|
117
|
+
</message>
|
118
|
+
<message name="acknowledgment">
|
119
|
+
<parameter name="key" type="string"/>
|
120
|
+
</message>
|
121
|
+
|
122
|
+
<message name="details">
|
123
|
+
<optional>
|
124
|
+
<parameter name="url" type="string"/>
|
125
|
+
</optional>
|
126
|
+
<oneOrMore>
|
127
|
+
<parameter name="topic" type="string"/>
|
128
|
+
<choice>
|
129
|
+
<parameter name="votes" type="string">
|
130
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
131
|
+
</parameter>
|
132
|
+
<parameter name="events" type="string">
|
133
|
+
<param name="pattern">([\w-_]+,)*([\w-_]+)</param>
|
134
|
+
</parameter>
|
135
|
+
</choice>
|
136
|
+
</oneOrMore>
|
137
|
+
</message>
|
138
|
+
|
139
|
+
<message name="overview">
|
140
|
+
<parameter name="overview" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
|
141
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
142
|
+
<start>
|
143
|
+
<element name="overview">
|
144
|
+
<element name="topics">
|
145
|
+
<empty/>
|
146
|
+
</element>
|
147
|
+
<element name="subscriptions">
|
148
|
+
<empty/>
|
149
|
+
</element>
|
150
|
+
</element>
|
151
|
+
</start>
|
152
|
+
</grammar>
|
153
|
+
</parameter>
|
154
|
+
</message>
|
155
|
+
|
156
|
+
<resource pattern="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
|
157
|
+
<resource relative="notifications">
|
158
|
+
<get in="*" out="overview"/>
|
159
|
+
<resource relative="topics">
|
160
|
+
<get in="*" out="topics"/>
|
161
|
+
</resource>
|
162
|
+
<resource relative="subscriptions">
|
163
|
+
<get in="*" out="subscriptions"/>
|
164
|
+
<post in="subscribe" out="acknowledgment"/>
|
165
|
+
<resource>
|
166
|
+
<get out="subscription"/>
|
167
|
+
<put in="details"/>
|
168
|
+
<delete/>
|
169
|
+
<resource relative="sse">
|
170
|
+
<sse/>
|
171
|
+
</resource>
|
172
|
+
</resource>
|
173
|
+
</resource>
|
174
|
+
</resource>
|
175
|
+
</resource>
|
176
|
+
|
177
|
+
</description>
|
data/riddl.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.101.
|
4
|
+
version: 0.101.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen 'eTM' Mangler
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: tools
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-07-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: daemonite
|
@@ -442,6 +442,7 @@ files:
|
|
442
442
|
- lib/ruby/riddl/ns/common-patterns/downloadify/1.0/downloadify.xml
|
443
443
|
- lib/ruby/riddl/ns/common-patterns/notifications-consumer/1.0/consumer.xml
|
444
444
|
- lib/ruby/riddl/ns/common-patterns/notifications-producer/1.0/producer.xml
|
445
|
+
- lib/ruby/riddl/ns/common-patterns/notifications-producer/2.0/producer.xml
|
445
446
|
- lib/ruby/riddl/ns/common-patterns/oauth2-univie-app/1.0/app.xml
|
446
447
|
- lib/ruby/riddl/ns/common-patterns/oauth2-univie-app/1.0/bearer-delete.xml
|
447
448
|
- lib/ruby/riddl/ns/common-patterns/oauth2-univie-app/1.0/bearer-get.xml
|
@@ -501,6 +502,7 @@ files:
|
|
501
502
|
- ns/common-patterns/downloadify/1.0/downloadify.xml
|
502
503
|
- ns/common-patterns/notifications-consumer/1.0/consumer.xml
|
503
504
|
- ns/common-patterns/notifications-producer/1.0/producer.xml
|
505
|
+
- ns/common-patterns/notifications-producer/2.0/producer.xml
|
504
506
|
- ns/common-patterns/oauth2-univie-app/1.0/app.xml
|
505
507
|
- ns/common-patterns/oauth2-univie-app/1.0/bearer-delete.xml
|
506
508
|
- ns/common-patterns/oauth2-univie-app/1.0/bearer-get.xml
|