Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

uninitialized constant Apiary::Command::Fetch::OpenStruct (NameError) #219

@mark-young-atg

Description

@mark-young-atg

The apiary fetch command is giving me an OpenStruct error:

➜  apiary fetch --api-name="api" --output="api.apib"
Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead.
/Users/user/.rvm/gems/ruby-3.3.1@apidocs/gems/apiaryio-0.17.0/lib/apiary/command/fetch.rb:12:in `initialize': uninitialized constant Apiary::Command::Fetch::OpenStruct (NameError)

      @options = OpenStruct.new(opts)
                 ^^^^^^^^^^
	from /Users/user/.rvm/gems/ruby-3.3.1@apidocs/gems/apiaryio-0.17.0/lib/apiary/cli.rb:28:in `new'

This can be fixed by adding require 'ostruct' after the require 'json' in gems/apiaryio-0.17.0/lib/apiary/command/fetch.rb
e.g.

➜  head -7 /Users/user/.rvm/gems/ruby-3.3.1@apidocs/gems/apiaryio-0.17.0/lib/apiary/command/fetch.rb
# encoding: utf-8

require 'rest-client'
require 'json'
require 'ostruct'

require 'apiary/agent'

I have not raised this as a pull request at this point as I felt it was worth a discussion first.
I'm not sure if this is related to the version of Ruby. I'm using v3.3.1.
Please let me know your thoughts and whether I should raise this as a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions