Skip to content
This repository was archived by the owner on Sep 24, 2019. It is now read-only.

Commit f011964

Browse files
committed
Add non-null to fields
1 parent be0cfe9 commit f011964

File tree

7 files changed

+69
-69
lines changed

7 files changed

+69
-69
lines changed

app/models/graph/types/film.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ module Types
1414
connection :characters, Graph::Types::Person.connection_type
1515
connection :planets, Graph::Types::Planet.connection_type
1616

17-
field :title, types.String, "The title of this film"
18-
field :episodeID, types.Int, "The episode number of this film.", property: :episode_id
19-
field :openingCrawl, types.String,
17+
field :title, !types.String, "The title of this film"
18+
field :episodeID, !types.Int, "The episode number of this film.", property: :episode_id
19+
field :openingCrawl, !types.String,
2020
"The opening paragraphs at the beginning of this film.", property: :opening_crawl
2121

22-
field :director, types.String, "The name of the director of this film."
23-
field :producers, types[types.String] do
22+
field :director, !types.String, "The name of the director of this film."
23+
field :producers, !types[!types.String] do
2424
description "The name(s) of the producer(s) of this film."
2525
resolve ->(film, _, _) { film.producer.split(", ") }
2626
end
2727

28-
field :releaseDate, types.String,
28+
field :releaseDate, !types.String,
2929
"The ISO 8601 date format of film release at original creator country.", property: :release_date
3030

31-
field :created_at, types.String, "The ISO 8601 date format of the time that this resource was created."
32-
field :updated_at, types.String, "The ISO 8601 date format of the time that this resource was edited."
31+
field :created_at, !types.String, "The ISO 8601 date format of the time that this resource was created."
32+
field :updated_at, !types.String, "The ISO 8601 date format of the time that this resource was edited."
3333
end
3434
end
3535
end

app/models/graph/types/person.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ module Types
1212
connection :vehicles, Graph::Types::Vehicle.connection_type
1313
connection :films, Graph::Types::Film.connection_type
1414

15-
field :birthYear, types.String,
15+
field :birthYear, !types.String,
1616
"The birth year of the person, using the in-universe standard of BBY or ABY"\
1717
" - Before the Battle of Yavin or After the Battle of Yavin. The Battle of Yavin"\
1818
" is a battle that occurs at the end of Star Wars episode IV: A New Hope.",
1919
property: :birth_year
2020

21-
field :eyeColor, types.String,
21+
field :eyeColor, !types.String,
2222
"The eye color of this person. Will be \"unknown\" if not known or \"n/a\" if the person does not have an eye.",
2323
property: :eye_color
2424

25-
field :gender, GenderEnum, "​The gender of this person."
26-
field :hairColor, types.String,
25+
field :gender, !GenderEnum, "​The gender of this person."
26+
field :hairColor, !types.String,
2727
"The hair color of this person. Will be \"unknown\" if not known or \"n/a\" if the person does not have hair.",
2828
property: :hair_color
2929

30-
field :height, types.Int, "The height of the person in centimeters."
31-
field :homeworld, Planet, "A planet that this person was born on or inhabits."
32-
field :mass, types.Int, "The mass of the person in kilograms."
33-
field :name, types.String, "The name of this person."
34-
field :skinColor, types.String, "The skin color of this person.", property: :skin_color
30+
field :height, !types.Int, "The height of the person in centimeters."
31+
field :homeworld, !Planet, "A planet that this person was born on or inhabits."
32+
field :mass, !types.Int, "The mass of the person in kilograms."
33+
field :name, !types.String, "The name of this person."
34+
field :skinColor, !types.String, "The skin color of this person.", property: :skin_color
3535
end
3636
end
3737
end

app/models/graph/types/planet.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ module Types
1111
connection :films, Graph::Types::Film.connection_type
1212
connection :residents, Graph::Types::Person.connection_type
1313

14-
field :name, types.String, "The name of this planet."
15-
field :diameter, types.Int, "The diameter of this planet in kilometers."
14+
field :name, !types.String, "The name of this planet."
15+
field :diameter, !types.Int, "The diameter of this planet in kilometers."
1616

17-
field :rotationPeriod, types.Int,
17+
field :rotationPeriod, !types.Int,
1818
"The number of standard hours it takes for this planet to complete a single rotation on its axis.",
1919
property: :rotation_period
2020

21-
field :orbitalPeriod, types.Int,
21+
field :orbitalPeriod, !types.Int,
2222
"The number of standard days it takes for this planet to complete a single orbit of its local star.",
2323
property: :orbital_period
2424

25-
field :gravity, types.String,
25+
field :gravity, !types.String,
2626
"A number denoting the gravity of this planet, where \"1\" is normal or 1 standard G."\
2727
" \"2\" is twice or 2 standard Gs. \"0.5\" is half or 0.5 standard Gs."
2828

29-
field :population, types.Float, "The average population of sentient beings inhabiting this planet."
30-
field :climate, types.String, "The climate of this planet."
31-
field :terrain, types.String, "The terrain of this planet."
29+
field :population, !types.Float, "The average population of sentient beings inhabiting this planet."
30+
field :climate, !types.String, "The climate of this planet."
31+
field :terrain, !types.String, "The terrain of this planet."
3232

33-
field :surfaceWater, types.Float,
33+
field :surfaceWater, !types.Float,
3434
"The percentage of the planet surface that is naturally occuring water or bodies of water.",
3535
property: :surface_water
3636
end

app/models/graph/types/species.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ module Types
1111
connection :people, Graph::Types::Person.connection_type
1212
connection :films, Graph::Types::Film.connection_type
1313

14-
field :name, types.String, "The name of this species."
15-
field :classification, types.String, "The classification of this species, such as \"mammal\" or \"reptile\"."
16-
field :designation, types.String, "The designation of this species, such as \"sentient\"."
14+
field :name, !types.String, "The name of this species."
15+
field :classification, !types.String, "The classification of this species, such as \"mammal\" or \"reptile\"."
16+
field :designation, !types.String, "The designation of this species, such as \"sentient\"."
1717

18-
field :averageHeight, types.Float do
18+
field :averageHeight, !types.Float do
1919
description "The average height of this species in centimeters."
2020
property :average_height
2121
end
@@ -41,16 +41,16 @@ module Types
4141
end
4242
end
4343

44-
field :skinColors, types[types.String] do
44+
field :skinColors, types[!types.String] do
4545
description "Common skin colors for this species, null if this species does not typically have skin."
4646
resolve ->(species, _, _) do
4747
return unless colors = species.skin_colors
4848
colors.split(", ")
4949
end
5050
end
5151

52-
field :language, types.String, "The language commonly spoken by this species."
53-
field :homeworld, Graph::Types::Planet, "A planet that this species originates from type."
52+
field :language, !types.String, "The language commonly spoken by this species."
53+
field :homeworld, !Graph::Types::Planet, "A planet that this species originates from type."
5454
end
5555
end
5656
end

app/models/graph/types/starship.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ module Types
1010

1111
# Starship Specific Fields
1212

13-
field :starshipClass, types.String do
13+
field :starshipClass, !types.String do
1414
description "The class of this starship, such as \"Starfighter\" or \"Deep Space Mobile Battlestation\""
1515
property :starship_class
1616
end
1717

18-
field :hyperdriveRating, types.Float, "The class of this starships hyperdrive.", property: :hyperdrive_rating
18+
field :hyperdriveRating, !types.Float, "The class of this starships hyperdrive.", property: :hyperdrive_rating
1919

20-
field :MGLT, types.Int do
20+
field :MGLT, !types.Int do
2121
description "
2222
The Maximum number of Megalights this starship can travel in a standard hour.
2323
A \"Megalight\" is a standard unit of distance and has never been
@@ -30,31 +30,31 @@ module Types
3030

3131
# Transport Interface Fields
3232

33-
field :name, types.String, "The name of this starship. The common name, such as \"Death Star\"."
34-
field :model, types.String, "The model or official name of this starship. Such as \"T-65 X-wing\" or \"DS-1 Orbital Battle Station\"."
33+
field :name, !types.String, "The name of this starship. The common name, such as \"Death Star\"."
34+
field :model, !types.String, "The model or official name of this starship. Such as \"T-65 X-wing\" or \"DS-1 Orbital Battle Station\"."
3535

36-
field :manufacturer, types.String, "The manufacturer of this starship."
37-
field :costInCredits, types.Float, "The cost of this starship new, in galactic credits", property: :cost_in_credits
38-
field :length, types.Float, "The length of this starship in meters."
39-
field :crew, types.String, "The number of personnel needed to run or pilot this starship."
40-
field :passengers, types.String, "The number of non-essential people this starship can transport."
36+
field :manufacturer, !types.String, "The manufacturer of this starship."
37+
field :costInCredits, !types.Float, "The cost of this starship new, in galactic credits", property: :cost_in_credits
38+
field :length, !types.Float, "The length of this starship in meters."
39+
field :crew, !types.String, "The number of personnel needed to run or pilot this starship."
40+
field :passengers, !types.String, "The number of non-essential people this starship can transport."
4141

4242
field :maxAtmospheringSpeed, types.Int do
4343
description "The maximum speed of this starship in atmosphere. null
4444
if this starship is incapable of atmosphering flight."
4545
property :max_atmosphering_speed
4646
end
4747

48-
field :cargoCapacity, types.Float do
48+
field :cargoCapacity, !types.Float do
4949
description "The maximum number of kilograms that this starship can transport."
5050
property :cargo_capacity
5151
end
5252

53-
field :consumables, types.String, "The maximum length of time that this starship can provide consumables for its entire crew without having to resupply."
53+
field :consumables, !types.String, "The maximum length of time that this starship can provide consumables for its entire crew without having to resupply."
5454
connection :pilots, Graph::Types::Person.connection_type
5555

56-
field :created_at, types.String, "The ISO 8601 date format of the time that this resource was created."
57-
field :updated_at, types.String, "The ISO 8601 date format of the time that this resource was updated."
56+
field :created_at, !types.String, "The ISO 8601 date format of the time that this resource was created."
57+
field :updated_at, !types.String, "The ISO 8601 date format of the time that this resource was updated."
5858
end
5959
end
6060
end

app/models/graph/types/transport_interface.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ module Types
44
name "Transport"
55
description "A single transport craft"
66

7-
field :name, types.String
8-
field :model, types.String
9-
field :manufacturer, types.String
10-
field :costInCredits, types.Float
11-
field :length, types.Float
12-
field :crew, types.String
13-
field :passengers, types.String
7+
field :name, !types.String
8+
field :model, !types.String
9+
field :manufacturer, !types.String
10+
field :costInCredits, !types.Float
11+
field :length, !types.Float
12+
field :crew, !types.String
13+
field :passengers, !types.String
1414
field :maxAtmospheringSpeed, types.Int
15-
field :cargoCapacity, types.Float
16-
field :consumables, types.String
15+
field :cargoCapacity, !types.Float
16+
field :consumables, !types.String
1717
connection :pilots, Graph::Types::Person.connection_type
1818
end
1919
end

app/models/graph/types/vehicle.rb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,37 @@ module Types
1010

1111
# Vehicle Specific Fields
1212

13-
field :vehicleClass, types.String do
13+
field :vehicleClass, !types.String do
1414
description "The class of this vehicle, such as \"Wheeled\" or \"Repulsorcraft\"."
1515
property :vehicle_class
1616
end
1717

1818
# Transport Interface Fields
19-
field :name, types.String, "The name of this vehicle. The common name, such as \"Sand Crawler\" or \"Speeder bike\""
20-
field :model, types.String, "The model or official name of this vehicle. Such as \"All-Terrain Attack Transport\"."
19+
field :name, !types.String, "The name of this vehicle. The common name, such as \"Sand Crawler\" or \"Speeder bike\""
20+
field :model, !types.String, "The model or official name of this vehicle. Such as \"All-Terrain Attack Transport\"."
2121

22-
field :manufacturer, types.String, "The manufacturer of this vehicle."
23-
field :costInCredits, types.Float, "The cost of this vehicle new, in galactic credits", property: :cost_in_credits
24-
field :length, types.Float, "The length of this vehicle in meters."
25-
field :crew, types.String, "The number of personnel needed to run or pilot this vehicle."
26-
field :passengers, types.String, "The number of non-essential people this vehicle can transport."
22+
field :manufacturer, !types.String, "The manufacturer of this vehicle."
23+
field :costInCredits, !types.Float, "The cost of this vehicle new, in galactic credits", property: :cost_in_credits
24+
field :length, !types.Float, "The length of this vehicle in meters."
25+
field :crew, !types.String, "The number of personnel needed to run or pilot this vehicle."
26+
field :passengers, !types.String, "The number of non-essential people this vehicle can transport."
2727

2828
field :maxAtmospheringSpeed, types.Int do
2929
description "The maximum speed of this vehicle in atmosphere. null
3030
if this vehicle is incapable of atmosphering flight."
3131
property :max_atmosphering_speed
3232
end
3333

34-
field :cargoCapacity, types.Float do
34+
field :cargoCapacity, !types.Float do
3535
description "The maximum number of kilograms that this vehicle can transport."
3636
property :cargo_capacity
3737
end
38-
39-
field :consumables, types.String, "The maximum length of time that this vehicle can provide consumables for its entire crew without having to resupply."
38+
39+
field :consumables, !types.String, "The maximum length of time that this vehicle can provide consumables for its entire crew without having to resupply."
4040
connection :pilots, Graph::Types::Person.connection_type
4141

42-
field :created_at, types.String, "The ISO 8601 date format of the time that this resource was created."
43-
field :updated_at, types.String, "The ISO 8601 date format of the time that this resource was updated."
42+
field :created_at, !types.String, "The ISO 8601 date format of the time that this resource was created."
43+
field :updated_at, !types.String, "The ISO 8601 date format of the time that this resource was updated."
4444
end
4545
end
4646
end

0 commit comments

Comments
 (0)