oas_core 0.4.0 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 342155f509e56cc99810dd3883b97d5d274546e2592108c937c746d47daec610
4
- data.tar.gz: c4dd49a6427f7e9189b626359af59c245828073a94bda3a04c5870493620ac5f
3
+ metadata.gz: '019372235c3a772e19f7e7c60b15b3409130efbd8a16d9a75a5c7c9a1a9ecd09'
4
+ data.tar.gz: 694f56c8a25feeb710a0a431ae44e3975a8b8b23a72d2433570f944de1b002f0
5
5
  SHA512:
6
- metadata.gz: '069f0e27323893c9195f244ed21739f8b4fe04e9a9e424aa9f3fe6b4b4f2cd45ee2bfb16882eb4196f2dcbdef8dca472a2979608c89f9a2ecadc5d987cc57d73'
7
- data.tar.gz: 929d2ce828e2b9ae88473d6401d8b2f8d7c1199b3908ede351588c83b620c10f097012c19eb11a2dc076b65130e09def523c30a567d06423ccbd764bcc0a454b
6
+ metadata.gz: cb19a595ad1d2031eb0872b5c2d795b63e113ae7920fd74fafec502193a71e5c1b900c4edaecdbacd8951721dd8b419eec82c80dfcf8ee5102d5e947d7889cf6
7
+ data.tar.gz: 59f273f6e638a37d54bd010e79faff713d3df1713f494dc4dec752fae1bbfdd1276bbad5eb87115e787a80e01af129f7f7f56d451d20df152bd4fc6f7f2e73c3
data/README.md CHANGED
@@ -1,13 +1,16 @@
1
1
  ![Gem Version](https://img.shields.io/gem/v/oas_core?color=E9573F)
2
2
  ![GitHub License](https://img.shields.io/github/license/a-chacon/oas_core?color=blue)
3
- ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/a-chacon/oas_core/.github%2Fworkflows%2Frubyonrails.yml)
3
+ ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/a-chacon/oas_core/.github%2Fworkflows%2Fruby.yml)
4
4
  ![Gem Total Downloads](https://img.shields.io/gem/dt/oas_core)
5
- ![Static Badge](https://img.shields.io/badge/Rails-%3E%3D7.0.0-%23E9573F)
6
5
  ![Static Badge](https://img.shields.io/badge/Ruby-%3E%3D3.1.0-%23E9573F)
7
6
 
8
- # 📃Open API Specification For Rails
7
+ # 📃Open API Specification Core
9
8
 
10
- Generates OpenAPI Specification (OAS) documents by analyzing and extracting routes from Rails applications.
9
+ OasCore is a Ruby gem designed to generate Open API Specification (OAS) 3.1 documentation directly from YARD comments in your endpoints. It serves as the core engine for OAS generation, while framework-specific adapters like `OasRails` (for Ruby on Rails) handle the extraction, integration and additional features.
10
+
11
+ ## Framework adapters
12
+
13
+ - **[OasRails](https://github.com/a-chacon/oas_rails)**
11
14
 
12
15
  ## Documentation
13
16
 
@@ -30,8 +30,9 @@ module OasCore
30
30
  private
31
31
 
32
32
  def extract_summary(oas_route:)
33
- oas_route.tags(:summary).first.try(:text) || generate_crud_name(oas_route.method_name,
34
- oas_route.controller.downcase) || "#{oas_route.verb} #{oas_route.path}"
33
+ summary_tag = oas_route.tags(:summary).first
34
+ summary_tag&.text || generate_crud_name(oas_route.method_name,
35
+ oas_route.controller.downcase) || "#{oas_route.verb} #{oas_route.path}"
35
36
  end
36
37
 
37
38
  def extract_operation_id(oas_route:)
@@ -50,7 +51,7 @@ module OasCore
50
51
  def default_tags(oas_route:)
51
52
  tags = []
52
53
  if OasCore.config.default_tags_from == :namespace
53
- tag = oas_route.path.split('/').reject(&:empty?).first.try(:titleize)
54
+ tag = oas_route.path.split('/').reject(&:empty?).first&.titleize
54
55
  tags << tag unless tag.nil?
55
56
  else
56
57
  tags << oas_route.controller.gsub('/', ' ').titleize
@@ -11,7 +11,7 @@ module OasCore
11
11
  def from_oas_route(oas_route)
12
12
  parameters_from_tags(tags: oas_route.tags(:parameter))
13
13
 
14
- oas_route.path_params.try(:map) do |p|
14
+ oas_route.path_params&.map do |p|
15
15
  @parameters << ParameterBuilder.new(@specification).from_path(oas_route.path, p).build unless @parameters.any? { |param| param.name.to_s == p.to_s }
16
16
  end
17
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OasCore
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oas_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - a-chacon