katarina 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 43ab1c6567c37055c23ed9124d0f8b9add6ab70a94d5b5407887658e912001c7
4
+ data.tar.gz: a39845bd2f5982306e5434bd5fbf7fbe1357a7c9f759af2862b0a381df29f797
5
+ SHA512:
6
+ metadata.gz: a508469b087a906598ef45f32d126bfe6a583c8f698266d40e30d4314547a4e1450bfca3432a2d088c5df50f59461f49e0d80ca967d5b147788de3f6bada7594
7
+ data.tar.gz: 9c9bd1067dd1f825a79885c4df133778a49e3bb3437eb2e319ce1a45dd4a0240172bd4b048f7fa8871e4e383144495bed1d84c07896adf9fb3499d79c38f5e31
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 masatoshi_moritsuka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,118 @@
1
+ # Katarina
2
+
3
+ This gem generates type definition files for TypeScript from a OpenAPI Documentation generated by `rspec-openapi`.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'katarina', group: :development
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ ## Usage
18
+
19
+ Execute below command
20
+
21
+ ```shell script
22
+ $ bin/rails katarina:generate
23
+ ```
24
+
25
+ ### Example
26
+
27
+ `#{Katarina.config.input_path}` contents is below:
28
+
29
+ ```yaml
30
+ ---
31
+ openapi: 3.0.3
32
+ info:
33
+ title: sample
34
+ paths:
35
+ "/v1/users/{user_id}/posts":
36
+ get:
37
+ summary: 'api/v1/users/posts #index'
38
+ parameters:
39
+ - name: user_id
40
+ in: path
41
+ required: true
42
+ schema:
43
+ type: integer
44
+ responses:
45
+ '200':
46
+ description: HTTP status is 200
47
+ content:
48
+ application/json:
49
+ schema:
50
+ type: object
51
+ properties:
52
+ id:
53
+ type: integer
54
+ name:
55
+ type: string
56
+ comments:
57
+ type: array
58
+ items:
59
+ type: object
60
+ properties:
61
+ id:
62
+ type: integer
63
+ deleted:
64
+ type: boolan
65
+ # ...
66
+ ```
67
+
68
+ And then it will generate `#{Katarina.config.output_dir}/api/users/posts.d.ts` like the following contents:
69
+
70
+ ```ts
71
+ type TApiUsersPostsIndex200 = {
72
+ id: number
73
+ name: string
74
+ comments: {
75
+ id: number
76
+ deleted: boolean
77
+ }[]
78
+ }
79
+ ```
80
+
81
+ ### Configuration
82
+
83
+ The following configurations are optional.
84
+
85
+ ```ruby
86
+ Katarina.configure do |config|
87
+ # Change the input path to generate types from RSpec::OpenAPI.path
88
+ config.input_path = 'doc/schema.yaml'
89
+
90
+ # Change the output directory to generate types from #{RSpec::OpenAPI.path}/types
91
+ config.output_dir = 'doc/types'
92
+
93
+ # Sets the paths to be excluded from type naming and generating type definition file path
94
+ config.exclude_paths = %w[api v1]
95
+
96
+ # Disable type name prefix
97
+ config.prefix = false
98
+ end
99
+ ```
100
+
101
+ ## Development
102
+
103
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. If you want to check it with an old version of Ruby, run `bin/build` and transpile it.
104
+
105
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
106
+
107
+ ## Contributing
108
+
109
+ Bug reports and pull requests are welcome on GitHub at https://github.com/sanfrecce-osaka/katarina. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/katarina/blob/master/CODE_OF_CONDUCT.md).
110
+
111
+
112
+ ## License
113
+
114
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
115
+
116
+ ## Code of Conduct
117
+
118
+ Everyone interacting in the Katarina project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/sanfrecce-osaka/katarina/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle exec ruby-next nextify lib/
4
+ rake build
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "katarina"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ using RubyNext;
3
+ require 'yaml'
4
+
5
+ module Katarina
6
+ module Parser
7
+ class << self
8
+ def parse(path)
9
+ path
10
+ .then(&File.method(:read))
11
+ .then { |_1| YAML.load(_1, symbolize_names: true) }
12
+ .then(&method(:build_schemas))
13
+ end
14
+
15
+ private
16
+
17
+ def build_schemas(doc)
18
+ path_and_method_pairs(doc[:paths]).flat_map do |pair|
19
+ (__m__ = pair) && (((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__ = __m__.deconstruct_keys([:path, :http_method])) || true) && ((Hash === __m_hash__) || Kernel.raise(TypeError, "#deconstruct_keys must return Hash")))) && ((__m_hash__.key?(:path) && __m_hash__.key?(:http_method)) && (((path = __m_hash__[:path]) || true) && ((http_method = __m_hash__[:http_method]) || true)))) || Kernel.raise(NoMatchingPatternError, __m__.inspect))
20
+ (__m__ = doc[:paths][path][http_method]) && (((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__ = __m__.deconstruct_keys([:responses, :summary])) || true) && ((Hash === __m_hash__) || Kernel.raise(TypeError, "#deconstruct_keys must return Hash")))) && ((__m_hash__.key?(:responses) && __m_hash__.key?(:summary)) && (((responses = __m_hash__[:responses]) || true) && ((summary = __m_hash__[:summary]) || true)))) || Kernel.raise(NoMatchingPatternError, __m__.inspect))
21
+ responses.keys.map do |response_code|
22
+ Schema.new(
23
+ path,
24
+ *summary.split(' ').then { |_1| [_1.first, _1.last[1..-1]] },
25
+ http_method,
26
+ response_code,
27
+ responses[response_code][:content][:'application/json'][:schema]
28
+ )
29
+ end
30
+ end
31
+ end
32
+
33
+ def path_and_method_pairs(paths)
34
+ paths.keys.flat_map do |path|
35
+ paths[path].keys.map do |http_method|
36
+ { path: path, http_method: http_method }
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ using RubyNext
4
+
5
+ module Katarina
6
+ module Generatable
7
+ def generate
8
+ Parser
9
+ .parse(Katarina.config.input_path)
10
+ .group_by(&:controller)
11
+ .each do |controller, schemas|
12
+ schemas
13
+ .map(&TypeGenerator.method(:generate))
14
+ .join("\n")
15
+ .then { |_1| Printer.write(_1, controller.split('/')) }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+ using RubyNext;
3
+ require 'yaml'
4
+
5
+ module Katarina
6
+ module Parser
7
+ class << self
8
+ def parse(path)
9
+ path
10
+ .then(&File.method(:read))
11
+ .then { |_1| YAML.load(_1, symbolize_names: true) }
12
+ .then(&method(:build_schemas))
13
+ end
14
+
15
+ private
16
+
17
+ def build_schemas(doc)
18
+ path_and_method_pairs(doc[:paths]).flat_map do |pair|
19
+ (__m__ = pair) && (((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__ = __m__.deconstruct_keys([:path, :http_method])) || true) && ((Hash === __m_hash__) || Kernel.raise(TypeError, "#deconstruct_keys must return Hash")))) && ((__m_hash__.key?(:path) && __m_hash__.key?(:http_method)) && (((path = __m_hash__[:path]) || true) && ((http_method = __m_hash__[:http_method]) || true)))) || Kernel.raise(NoMatchingPatternError, __m__.inspect))
20
+ (__m__ = doc[:paths][path][http_method]) && (((__m__.respond_to?(:deconstruct_keys) && (((__m_hash__ = __m__.deconstruct_keys([:responses, :summary])) || true) && ((Hash === __m_hash__) || Kernel.raise(TypeError, "#deconstruct_keys must return Hash")))) && ((__m_hash__.key?(:responses) && __m_hash__.key?(:summary)) && (((responses = __m_hash__[:responses]) || true) && ((summary = __m_hash__[:summary]) || true)))) || Kernel.raise(NoMatchingPatternError, __m__.inspect))
21
+ responses.keys.map do |response_code|
22
+ Schema.new(
23
+ path,
24
+ *summary.split(' ').then { |_1| [_1.first, _1.last[1..]] },
25
+ http_method,
26
+ response_code,
27
+ responses[response_code][:content][:'application/json'][:schema]
28
+ )
29
+ end
30
+ end
31
+ end
32
+
33
+ def path_and_method_pairs(paths)
34
+ paths.keys.flat_map do |path|
35
+ paths[path].keys.map do |http_method|
36
+ { path: path, http_method: http_method }
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Katarina
4
+ module Path
5
+ class << self
6
+ def include_paths(paths)
7
+ paths.reject { |_1| Katarina.config.exclude_paths.include?(_1) }
8
+ end
9
+
10
+ def output_path(paths)
11
+ [output_dir(paths), output_file_name(paths.last)].join('/')
12
+ end
13
+
14
+ def output_dir(paths)
15
+ [Dir.pwd, Katarina.config.output_dir, *include_paths(paths)[0..-2]].join('/')
16
+ end
17
+
18
+ def output_file_name(file_name)
19
+ file_name + '.d.ts'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Katarina
6
+ module Printer
7
+ class << self
8
+ def write(content, paths)
9
+ FileUtils.makedirs(Katarina::Path.output_dir(paths))
10
+ FileUtils.touch(Katarina::Path.output_path(paths))
11
+ File.open(Katarina::Path.output_path(paths), 'w+') { |_1| _1.write(content) }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+ using RubyNext;
3
+ require 'active_support/all'
4
+
5
+ module Katarina
6
+ class Schema
7
+ attr_reader :controller
8
+
9
+ def initialize(path, controller, action, http_method, response_code, schema)
10
+ @path = path
11
+ @controller = controller
12
+ @action = action
13
+ @http_method = http_method
14
+ @response_code = response_code
15
+ @schema = schema
16
+ end
17
+
18
+ def types(schema = @schema)
19
+ case; when (__m__ = schema) && false
20
+ when ((__p_1__ = __m__.respond_to?(:deconstruct_keys)) && (((__m_hash__ = __m__.deconstruct_keys([:type, :properties])) || true) && ((Hash === __m_hash__) || Kernel.raise(TypeError, "#deconstruct_keys must return Hash")))) && (((__p_3__ = __m_hash__.key?(:type)) && __m_hash__.key?(:properties)) && (("object" === __m_hash__[:type]) && ((properties = __m_hash__[:properties]) || true))) then build_object(properties)
21
+ when (__m_hash__ = __m__.deconstruct_keys([:type, :items])) && ((__p_3__ && __m_hash__.key?(:items)) && (("array" === __m_hash__[:type]) && ((items = __m_hash__[:items]) || true))) then [types(items)]
22
+ when (__m_hash__ = __m__.deconstruct_keys([:type])) && (__p_3__ && ((type = __m_hash__[:type]) || true)) then type; else; Kernel.raise(NoMatchingPatternError, __m__.inspect)
23
+ end
24
+ end
25
+
26
+ def name
27
+ [
28
+ prefix,
29
+ *Katarina::Path.include_paths(@controller.split('/')),
30
+ action,
31
+ response_code.to_s
32
+ ].map(&:camelize).join
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :path, :action, :http_method, :response_code
38
+
39
+ def prefix
40
+ Katarina.config.prefix ? 'T' : ''
41
+ end
42
+
43
+ def build_object(properties)
44
+ properties.keys.each_with_object({}) { |_1, _2| _2[_1] = property_type(properties[_1]) }
45
+ end
46
+
47
+ def property_type(property)
48
+ case; when (__m__ = property) && false
49
+ when (__p_2__ = ((__p_1__ = __m__.respond_to?(:deconstruct_keys)) && (((__m_hash__ = __m__.deconstruct_keys([:type])) || true) && ((Hash === __m_hash__) || Kernel.raise(TypeError, "#deconstruct_keys must return Hash"))))) && ((__p_3__ = __m_hash__.key?(:type)) && (((__m_hash__el__ = __m_hash__[:type]) || true) && (("object" === __m_hash__el__) || ("array" === __m_hash__el__)))) then types(property)
50
+ when __p_2__ && (__p_3__ && ((type = __m_hash__[:type]) || true)) then type; else; Kernel.raise(NoMatchingPatternError, __m__.inspect)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ruby-next'
4
+ require 'ruby-next/language/setup'
5
+ RubyNext::Language.setup_gem_load_path(transpile: true)
6
+
7
+ require 'katarina/version'
8
+ require 'katarina/config'
9
+ require 'katarina/path'
10
+ require 'katarina/schema'
11
+ require 'katarina/parser'
12
+ require 'katarina/printer'
13
+ require 'katarina/type_generator'
14
+ require 'katarina/generatable'
15
+ require 'katarina/configurable'
16
+ require 'katarina/railtie' if defined?(Rails)
17
+
18
+ module Katarina
19
+ extend Generatable
20
+ extend Configurable
21
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rspec/openapi'
4
+
5
+ module Katarina
6
+ class Config
7
+ attr_accessor :output_dir, :exclude_paths, :prefix
8
+ attr_writer :input_path
9
+
10
+ def initialize
11
+ @input_path = RSpec::OpenAPI.path
12
+ @output_dir = [*@input_path.split('/')[0..-2], 'types'].join('/')
13
+ @exclude_paths = []
14
+ @prefix = true
15
+ end
16
+
17
+ def input_path
18
+ [Dir.pwd, @input_path].join('/')
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Katarina
4
+ module Configurable
5
+ def configure(&block)
6
+ block.call(config)
7
+ end
8
+
9
+ def config
10
+ @config ||= Config.new
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ using RubyNext
4
+
5
+ module Katarina
6
+ module Generatable
7
+ def generate
8
+ Parser
9
+ .parse(Katarina.config.input_path)
10
+ .group_by(&:controller)
11
+ .each do |controller, schemas|
12
+ schemas
13
+ .map(&TypeGenerator.method(:generate))
14
+ .join("\n")
15
+ .then { Printer.write(_1, controller.split('/')) }
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'yaml'
4
+
5
+ module Katarina
6
+ module Parser
7
+ class << self
8
+ def parse(path)
9
+ path
10
+ .then(&File.method(:read))
11
+ .then { YAML.load(_1, symbolize_names: true) }
12
+ .then(&method(:build_schemas))
13
+ end
14
+
15
+ private
16
+
17
+ def build_schemas(doc)
18
+ path_and_method_pairs(doc[:paths]).flat_map do |pair|
19
+ pair in { path:, http_method: }
20
+ doc[:paths][path][http_method] in { responses:, summary: }
21
+ responses.keys.map do |response_code|
22
+ Schema.new(
23
+ path,
24
+ *summary.split(' ').then { [_1.first, _1.last[1..]] },
25
+ http_method,
26
+ response_code,
27
+ responses[response_code][:content][:'application/json'][:schema]
28
+ )
29
+ end
30
+ end
31
+ end
32
+
33
+ def path_and_method_pairs(paths)
34
+ paths.keys.flat_map do |path|
35
+ paths[path].keys.map do |http_method|
36
+ { path: path, http_method: http_method }
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Katarina
4
+ module Path
5
+ class << self
6
+ def include_paths(paths)
7
+ paths.reject { Katarina.config.exclude_paths.include?(_1) }
8
+ end
9
+
10
+ def output_path(paths)
11
+ [output_dir(paths), output_file_name(paths.last)].join('/')
12
+ end
13
+
14
+ def output_dir(paths)
15
+ [Dir.pwd, Katarina.config.output_dir, *include_paths(paths)[0..-2]].join('/')
16
+ end
17
+
18
+ def output_file_name(file_name)
19
+ file_name + '.d.ts'
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fileutils'
4
+
5
+ module Katarina
6
+ module Printer
7
+ class << self
8
+ def write(content, paths)
9
+ FileUtils.makedirs(Katarina::Path.output_dir(paths))
10
+ FileUtils.touch(Katarina::Path.output_path(paths))
11
+ File.open(Katarina::Path.output_path(paths), 'w+') { _1.write(content) }
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/railtie'
4
+ require 'pathname'
5
+
6
+ module Katarina
7
+ class Railtie < Rails::Railtie
8
+ rake_tasks do
9
+ load Pathname.new(__dir__).join('rake.rb')
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc "generate type definition files for TypeScript from rspec-openapi's output"
4
+ task 'katarina:generate': :environment do
5
+ Katarina.generate
6
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/all'
4
+
5
+ module Katarina
6
+ class Schema
7
+ attr_reader :controller
8
+
9
+ def initialize(path, controller, action, http_method, response_code, schema)
10
+ @path = path
11
+ @controller = controller
12
+ @action = action
13
+ @http_method = http_method
14
+ @response_code = response_code
15
+ @schema = schema
16
+ end
17
+
18
+ def types(schema = @schema)
19
+ case schema
20
+ in { type: 'object', properties: } then build_object(properties)
21
+ in { type: 'array', items: } then [types(items)]
22
+ in { type: type } then type
23
+ end
24
+ end
25
+
26
+ def name
27
+ [
28
+ prefix,
29
+ *Katarina::Path.include_paths(@controller.split('/')),
30
+ action,
31
+ response_code.to_s
32
+ ].map(&:camelize).join
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :path, :action, :http_method, :response_code
38
+
39
+ def prefix
40
+ Katarina.config.prefix ? 'T' : ''
41
+ end
42
+
43
+ def build_object(properties)
44
+ properties.keys.each_with_object({}) { _2[_1] = property_type(properties[_1]) }
45
+ end
46
+
47
+ def property_type(property)
48
+ case property
49
+ in { type: 'object' | 'array' } then types(property)
50
+ in { type: } then type
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Katarina
4
+ module TypeGenerator
5
+ class << self
6
+ def generate(schema)
7
+ [
8
+ "type #{schema.name} = {",
9
+ members(schema.types),
10
+ "}\n"
11
+ ].join("\n")
12
+ end
13
+
14
+ private
15
+
16
+ def members(types, level = 1)
17
+ case types
18
+ when Hash
19
+ types.map { |name, type| member(name, type, level) }.join("\n")
20
+ when Array
21
+ "#{members(types.first, level)}[]"
22
+ else
23
+ types
24
+ end
25
+ end
26
+
27
+ def member(name, type, level)
28
+ case type
29
+ when Hash
30
+ [
31
+ "#{key(name, level)} {",
32
+ members(type, level + 1),
33
+ "#{indent(level)}}"
34
+ ]
35
+ when Array
36
+ if type.first != 'null'
37
+ "#{member(name, type.first, level).join("\n")}[]"
38
+ else
39
+ "#{key(name, level)} null[]"
40
+ end
41
+ when String
42
+ "#{key(name, level)} #{type == 'integer' ? 'number' : type}"
43
+ end
44
+ end
45
+
46
+ def key(name, level)
47
+ "#{indent(level)}#{name}:"
48
+ end
49
+
50
+ def indent(level)
51
+ ' ' * level
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,3 @@
1
+ module Katarina
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: katarina
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - masatoshi_moritsuka
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec-openapi
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ruby-next
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: This gem generates type definitions for TypeScript from a OpenAPI Documentation
70
+ generated by rspec-openapi.
71
+ email:
72
+ - yakiyaki_ikayaki@yahoo.co.jp
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - LICENSE.txt
78
+ - README.md
79
+ - bin/build
80
+ - bin/console
81
+ - bin/setup
82
+ - lib/.rbnext/2.6/katarina/parser.rb
83
+ - lib/.rbnext/2.7/katarina/generatable.rb
84
+ - lib/.rbnext/2.7/katarina/parser.rb
85
+ - lib/.rbnext/2.7/katarina/path.rb
86
+ - lib/.rbnext/2.7/katarina/printer.rb
87
+ - lib/.rbnext/2.7/katarina/schema.rb
88
+ - lib/katarina.rb
89
+ - lib/katarina/config.rb
90
+ - lib/katarina/configurable.rb
91
+ - lib/katarina/generatable.rb
92
+ - lib/katarina/parser.rb
93
+ - lib/katarina/path.rb
94
+ - lib/katarina/printer.rb
95
+ - lib/katarina/railtie.rb
96
+ - lib/katarina/rake.rb
97
+ - lib/katarina/schema.rb
98
+ - lib/katarina/type_generator.rb
99
+ - lib/katarina/version.rb
100
+ homepage: https://github.com/sanfrecce-osaka/katarina
101
+ licenses:
102
+ - MIT
103
+ metadata: {}
104
+ post_install_message:
105
+ rdoc_options: []
106
+ require_paths:
107
+ - lib
108
+ required_ruby_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 2.5.0
113
+ required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ requirements: []
119
+ rubyforge_project:
120
+ rubygems_version: 2.7.3
121
+ signing_key:
122
+ specification_version: 4
123
+ summary: This gem generates type definitions for TypeScript from a OpenAPI Documentation
124
+ generated by rspec-openapi.
125
+ test_files: []