Sha256: 7f0ce480b1ac5cb0e59b65bd1d2a802c6e23ea963289d0a0f9441566e3d35994

Contents?: true

Size: 1.23 KB

Versions: 7

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby

require 'bundler/setup'
require 'sober_swag'
require 'pry'

Bio = SoberSwag.input_object do
  attribute :description, SoberSwag::Types::String
  attribute :gender, SoberSwag::Types::String.enum('male', 'female') | SoberSwag::Types::String
end

Person = SoberSwag.input_object do
  attribute :name, SoberSwag::Types::String
  attribute? :bio, Bio.optional
end

MultiFloorLocation = SoberSwag.input_object do
  attribute :building, SoberSwag::Types::String.enum('science', 'mathematics', 'literature')
  attribute :floor, SoberSwag::Types::String
  attribute :room, SoberSwag::Types::Integer
end

SingleFloorLocation = SoberSwag.input_object do
  attribute :building, SoberSwag::Types::String.enum('philosophy', 'computer science')
  attribute :room, SoberSwag::Types::Integer
end

SchoolClass = SoberSwag.input_object do
  attribute :prof, Person.meta(description: 'The person who teaches this class.')
  attribute :students, SoberSwag::Types::Array.of(Person)
  attribute :location, (SingleFloorLocation | MultiFloorLocation).meta(description: 'What building and room this is in')
end

SortDirections = SoberSwag::Types::CommaArray.of(SoberSwag::Types::String.enum('created_at', 'updated_at', '-created_at', '-updated_at'))

Pry.start

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sober_swag-0.21.0 bin/console
sober_swag-0.20.0 bin/console
sober_swag-0.19.0 bin/console
sober_swag-0.18.0 bin/console
sober_swag-0.17.0 bin/console
sober_swag-0.16.0 bin/console
sober_swag-0.15.0 bin/console