json-api-vanilla 1.0.1 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0d265b20f67d08ed43d7400a31c9967a8d889d28
4
- data.tar.gz: 35615f3284b5251ddaa6f938a12a81233a6455da
2
+ SHA256:
3
+ metadata.gz: 7afa867c96d73aebae4bd98eb16c778d43847fa06baa76cc8c0a47ba1e2e9402
4
+ data.tar.gz: 2b95a21224c8569a23784576d86a41edc01a12188af52568e381fdda62e626c8
5
5
  SHA512:
6
- metadata.gz: 5d5c43003af1b69ad6765b133413db6f34788c153e49ed733e951d84121b4b652326dd22d7ed5a3c7df710efb15dead48f10b76d5629b3336ba2a639315bdfb4
7
- data.tar.gz: 52d80f203986990a057bece26ffee84eaa0df3a1036de155b325c37ce68c2c023a6c91542e15a4a4db033e85c8b46d51c8c0ddf4563c1a1efad35d42ce1967fa
6
+ metadata.gz: 5e9b07fe255d04b7ad67d5139ea0fd2cb4616c264c142ce39c107d2f4f2367e6ca7e0aee7ac1728d7cfc1f378cefd8e50888fe313e00d72879164e61490b5bc2
7
+ data.tar.gz: d2bfef862e0a14a585d3e91d8accdbb4426725026efa6b4af4cd97f9cb30cb38735ff65ad1f0ec17d1cdb56ffcde818d5efe241ad0a83bacbb8387516ae0b05a
@@ -0,0 +1,20 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.6.x
16
+ - name: Build and test with Rake
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs 4 --retry 3
20
+ make test
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  Gemfile.lock
2
2
  .ruby-version
3
3
  .rvmrc
4
+ .idea
4
5
  *.gem
data/Gemfile CHANGED
@@ -2,5 +2,6 @@ source "http://rubygems.org"
2
2
  gemspec
3
3
 
4
4
  group :test do
5
+ gem 'rspec'
5
6
  gem 'rake'
6
7
  end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2016 Trainline.com Ltd
1
+ Copyright 2016 Trainline.com Ltd, 2016-2022 Thaddée Tyl
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
data/Makefile CHANGED
@@ -1,5 +1,8 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  install:
3
3
  gem build json-api-vanilla.gemspec && gem install ./json-api-vanilla-*.gem
4
4
 
5
- .PHONY: install
5
+ test:
6
+ rspec
7
+
8
+ .PHONY: install test
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  require 'bundler'
@@ -1,4 +1,4 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
3
  require 'json-api-vanilla/version'
4
4
 
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ['Thaddée Tyl']
11
11
  s.email = ['thaddee.tyl@gmail.com']
12
- s.homepage = 'http://github.com/trainline/json-api-vanilla'
12
+ s.homepage = 'http://github.com/espadrine/json-api-vanilla'
13
13
  s.summary = %q{Deserialize JSON API formats into vanilla Ruby objects.}
14
14
  s.description = %q{Given a JSON API string, we parse it and return a document that can be browsed — as if the objects defined in the file were plain old Ruby objects.}
15
15
  s.files = `git ls-files`.split("\n")
@@ -1,4 +1,4 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  require "json"
3
3
 
4
4
  module JSON::Api; end
@@ -58,35 +58,43 @@ module JSON::Api::Vanilla
58
58
 
59
59
  obj_hashes.each do |o_hash|
60
60
  klass = prepare_class(o_hash, superclass, container)
61
- obj = klass.new
62
- obj.type = o_hash['type']
63
- obj.id = o_hash['id']
64
- if o_hash['attributes']
65
- o_hash['attributes'].each do |key, value|
66
- set_key(obj, key, value, original_keys)
67
- end
68
- end
61
+ obj = prepare_object(o_hash, klass, original_keys)
62
+
69
63
  if o_hash['links']
70
64
  links[obj] = o_hash['links']
71
65
  end
66
+
72
67
  objects[[obj.type, obj.id]] = obj
73
68
  end
74
69
 
75
70
  # Now that all objects have been created, we can link everything together.
76
71
  obj_hashes.each do |o_hash|
77
- klass = container.const_get(ruby_class_name(o_hash['type']).to_sym)
78
72
  obj = objects[[o_hash['type'], o_hash['id']]]
79
73
  if o_hash['relationships']
80
74
  o_hash['relationships'].each do |key, value|
75
+ naive_validate_relationship_object(value)
76
+
81
77
  if value['data']
82
78
  data = value['data']
83
79
  if data.is_a?(Array)
84
80
  # One-to-many relationship.
85
81
  ref = data.map do |ref_hash|
86
- objects[[ref_hash['type'], ref_hash['id']]]
82
+ _ref = objects[[ref_hash['type'], ref_hash['id']]]
83
+
84
+ if _ref.nil?
85
+ klass = prepare_class(ref_hash, superclass, container)
86
+ _ref = prepare_object(ref_hash, klass)
87
+ end
88
+
89
+ _ref
87
90
  end
88
91
  else
89
92
  ref = objects[[data['type'], data['id']]]
93
+
94
+ if ref.nil?
95
+ klass = prepare_class(data, superclass, container)
96
+ ref = prepare_object(data, klass)
97
+ end
90
98
  end
91
99
  end
92
100
 
@@ -116,7 +124,7 @@ module JSON::Api::Vanilla
116
124
 
117
125
  def self.prepare_class(hash, superclass, container)
118
126
  name = ruby_class_name(hash['type']).to_sym
119
- if container.const_defined?(name)
127
+ if container.constants.include?(name)
120
128
  klass = container.const_get(name)
121
129
  else
122
130
  klass = generate_object(name, superclass, container)
@@ -131,6 +139,18 @@ module JSON::Api::Vanilla
131
139
  klass
132
140
  end
133
141
 
142
+ def self.prepare_object(hash, klass, original_keys = {})
143
+ (klass.new).tap do |obj|
144
+ obj.type = hash['type']
145
+ obj.id = hash['id']
146
+ if hash['attributes']
147
+ hash['attributes'].each do |key, value|
148
+ set_key(obj, key, value, original_keys)
149
+ end
150
+ end
151
+ end
152
+ end
153
+
134
154
  def self.generate_object(ruby_name, superclass, container)
135
155
  klass = Class.new(superclass)
136
156
  container.const_set(ruby_name, klass)
@@ -180,6 +200,18 @@ module JSON::Api::Vanilla
180
200
  end
181
201
  end
182
202
 
203
+ # Naïvely validate a relationship object.
204
+ # @param hash [Hash] json:api document as a hash
205
+ # @raise [InvalidRootStructure] raised if the document doesn't have data, errors nor meta objects
206
+ # at its root.
207
+ def self.naive_validate_relationship_object(hash)
208
+ root_keys = %i(data meta links)
209
+ present_structures = root_keys & hash.keys.map(&:to_sym)
210
+ if present_structures.empty?
211
+ raise InvalidRootStructure.new("JSON:API relationship must contain at least one of these objects: #{root_keys.join(', ')}")
212
+ end
213
+ end
214
+
183
215
  class Document
184
216
  # @return [Object, Array<Object>] the content of the JSON API data.
185
217
  attr_reader :data
@@ -1,8 +1,8 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  module JSON
3
3
  module Api
4
4
  module Vanilla
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.4'
6
6
  end
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  require 'json-api-vanilla/parser'
3
3
  require 'json-api-vanilla/version'
@@ -1,4 +1,4 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  require 'spec_helper'
3
3
 
4
4
  describe JSON::Api::Vanilla do
@@ -20,6 +20,14 @@ describe JSON::Api::Vanilla do
20
20
  expect(doc.links[doc.data]['self']).to eql("http://example.com/articles")
21
21
  end
22
22
 
23
+ it "should read objects that are only in relationships of included" do
24
+ expect(doc.data.first.comments.first.post.id).to eql("42")
25
+ end
26
+
27
+ it "should read objects that are only in relationships of included when it is an array" do
28
+ expect(doc.data.first.comments.first.tags[0].id).to eql("42")
29
+ end
30
+
23
31
  it "should find objects by type and id" do
24
32
  expect(doc.find('comments', '5').body).to eql("First!")
25
33
  end
@@ -86,6 +94,35 @@ describe JSON::Api::Vanilla do
86
94
  end.to raise_error(JSON::Api::Vanilla::InvalidRootStructure)
87
95
  end
88
96
 
97
+ it "should raise an error if the document contains an unrecognized element" do
98
+ json = <<-JSON
99
+ {
100
+ "type": "object",
101
+ "id": "123",
102
+ "attributes": {},
103
+ "foo": "bar"
104
+ }
105
+ JSON
106
+ expect do
107
+ JSON::Api::Vanilla.parse(json)
108
+ end.to raise_error(JSON::Api::Vanilla::InvalidRootStructure)
109
+ end
110
+
111
+ it "should raise an error if a relationship object does not have one of the required fields" do
112
+ json = <<-JSON
113
+ {
114
+ "data": {
115
+ "type": "cycle",
116
+ "id": "1",
117
+ "relationships": { "cycle": { "type": "cycle", "id": "2" } }
118
+ }
119
+ }
120
+ JSON
121
+ expect do
122
+ JSON::Api::Vanilla.parse(json)
123
+ end.to raise_error(JSON::Api::Vanilla::InvalidRootStructure)
124
+ end
125
+
89
126
  it "should not raise any errors if the document contains root elements as symbols" do
90
127
  expect do
91
128
  JSON::Api::Vanilla.naive_validate(data: { id: 1, type: 'mvp' })
@@ -97,4 +134,41 @@ describe JSON::Api::Vanilla do
97
134
  JSON::Api::Vanilla.naive_validate(data: [])
98
135
  end.to_not raise_error
99
136
  end
137
+
138
+ describe '.prepare_class' do
139
+ let(:container) {Module.new}
140
+ let(:superclass) {Class.new}
141
+ let(:hash) {{'type' => 'test-classes'}}
142
+ subject {described_class.prepare_class(hash, superclass, container)}
143
+
144
+ context 'when same name class in global scope' do
145
+ class TestClasses
146
+ end
147
+
148
+ it 'should create dynamic class in container' do
149
+ subject
150
+ expect(container.constants).to include(:TestClasses)
151
+ end
152
+ end
153
+ end
154
+
155
+ describe '.prepare_object' do
156
+ let(:data) do
157
+ {
158
+ 'type' => 'example',
159
+ 'id' => '1',
160
+ 'attributes' => {
161
+ 'name' => 'example name'
162
+ }
163
+ }
164
+ end
165
+ let(:klass) { described_class.prepare_class(data, Class.new, Module.new) }
166
+ subject { described_class.prepare_object(data, klass) }
167
+
168
+ it 'creates an object with the attributes mapped' do
169
+ expect(subject.type).to eql(data['type'])
170
+ expect(subject.id).to eql(data['id'])
171
+ expect(subject.name).to eql(data['attributes']['name'])
172
+ end
173
+ end
100
174
  end
@@ -56,6 +56,17 @@
56
56
  "relationships": {
57
57
  "author": {
58
58
  "data": { "type": "people", "id": "2" }
59
+ },
60
+ "tags": {
61
+ "data": [
62
+ { "type": "tag", "id": "42" }
63
+ ]
64
+ },
65
+ "post": {
66
+ "data": {
67
+ "type": "post",
68
+ "id": "42"
69
+ }
59
70
  }
60
71
  },
61
72
  "links": {
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright © Trainline Limited, 2016. All rights reserved. See LICENSE.txt in the project root for license information.
1
+ # Copyright © Trainline Limited, 2016, Thaddée Tyl, 2016-2022. All rights reserved. See LICENSE.txt in the project root for license information.
2
2
  $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
3
3
 
4
4
  require 'rubygems'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-api-vanilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thaddée Tyl
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2022-06-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Given a JSON API string, we parse it and return a document that can be
14
14
  browsed — as if the objects defined in the file were plain old Ruby objects.
@@ -18,15 +18,14 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - ".github/workflows/ruby.yml"
21
22
  - ".gitignore"
22
- - ContributorAgreement.txt
23
23
  - Gemfile
24
24
  - LICENSE.txt
25
25
  - Makefile
26
26
  - NOTICE.txt
27
27
  - README.md
28
28
  - Rakefile
29
- - contributors/TadasTamosauskas.txt
30
29
  - json-api-vanilla.gemspec
31
30
  - lib/json-api-vanilla.rb
32
31
  - lib/json-api-vanilla/parser.rb
@@ -34,11 +33,11 @@ files:
34
33
  - spec/json-api-vanilla/diff_spec.rb
35
34
  - spec/json-api-vanilla/example.json
36
35
  - spec/spec_helper.rb
37
- homepage: http://github.com/trainline/json-api-vanilla
36
+ homepage: http://github.com/espadrine/json-api-vanilla
38
37
  licenses:
39
38
  - Apache-2.0
40
39
  metadata: {}
41
- post_install_message:
40
+ post_install_message:
42
41
  rdoc_options: []
43
42
  require_paths:
44
43
  - lib
@@ -53,9 +52,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
55
54
  requirements: []
56
- rubyforge_project:
57
- rubygems_version: 2.6.11
58
- signing_key:
55
+ rubygems_version: 3.1.2
56
+ signing_key:
59
57
  specification_version: 4
60
58
  summary: Deserialize JSON API formats into vanilla Ruby objects.
61
59
  test_files: []
@@ -1,17 +0,0 @@
1
- Contributor Agreement
2
- Thank you for your interest in Trainline. In order to clarify the intellectual property license granted with code contributions from any person or entity, Trainline.com Limited ("Trainline") requires a Contributor License Agreement on file that has been signed by each contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Trainline and its users; it does not change your rights to use your own contributions for any other purpose.
3
- Please send confirmation that you accept the terms set out below to osscontribs@thetrainline.com. Please read the terms carefully before accepting and keep a copy for your records.
4
- You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Trainline. Except for the license granted herein to Trainline and recipients of software distributed by Trainline, You reserve all right, title, and interest in and to Your Contributions.
5
-
6
- 1. Definitions.
7
- "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Trainline. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty per cent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
8
- "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Trainline for inclusion in, or documentation of, any of the products owned or managed by Trainline (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Trainline or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Trainline for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
9
- 2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Trainline and to recipients of software distributed by Trainline a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
10
- 3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Trainline and to recipients of software distributed by Trainline a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
11
- 4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Trainline, or that your employer has executed a separate agreement with Trainline.
12
- 5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
13
- 6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
14
- 7. Should You wish to submit work that is not Your original creation, You may submit it to Trainline separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
15
- 8. You agree to notify Trainline of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
16
-
17
- Please sign: __________________________________ Date: ________________
@@ -1,18 +0,0 @@
1
- Contributor Agreement
2
- Thank you for your interest in Trainline. In order to clarify the intellectual property license granted with code contributions from any person or entity, Trainline.com Limited ("Trainline") requires a Contributor License Agreement on file that has been signed by each contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Trainline and its users; it does not change your rights to use your own contributions for any other purpose.
3
- Please send confirmation that you accept the terms set out below to osscontribs@thetrainline.com. Please read the terms carefully before accepting and keep a copy for your records.
4
- You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Trainline. Except for the license granted herein to Trainline and recipients of software distributed by Trainline, You reserve all right, title, and interest in and to Your Contributions.
5
-
6
- 1. Definitions.
7
- "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Trainline. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty per cent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
8
- "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to Trainline for inclusion in, or documentation of, any of the products owned or managed by Trainline (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to Trainline or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Trainline for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
9
- 2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Trainline and to recipients of software distributed by Trainline a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
10
- 3. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Trainline and to recipients of software distributed by Trainline a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
11
- 4. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to Trainline, or that your employer has executed a separate agreement with Trainline.
12
- 5. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
13
- 6. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
14
- 7. Should You wish to submit work that is not Your original creation, You may submit it to Trainline separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
15
- 8. You agree to notify Trainline of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
16
-
17
- Please sign: Tadas Tamošauskas
18
- Date: 2016-10-06