apicollective / apibuilder-cli Goto Github PK
View Code? Open in Web Editor NEWCommand line interface to apibuilder
License: MIT License
Command line interface to apibuilder
License: MIT License
The output of running apidoc
in terminal is as follows:
$ apidoc [14:16:50]
** ERROR: Missing command is required. Available commands:
- cli
- code
- download
- example
- list
- update
- upload
However, only the following are documented: list
, code
, and update
. Running apidoc upload
yields a cryptic error to anyone unfamiliar with the tool:
$ apidoc upload [14:17:40]
org, application, path are required
It would be great if apidoc --help
returned some more information w/ specific examples.
after brew install apibuilder-cli:
When running /opt/homebrew/bin/create-config I get
/opt/homebrew/bin/create-config:9:in load': cannot load such file -- /opt/homebrew/bin/../src/apibuilder-cli.rb (LoadError) from /opt/homebrew/bin/create-config:9:in
Also it seems like apibuilder-cli wasn't added to my path after brew install
When I enable directory creation in the global settings, the CLI exits with no implicit conversion of nil into String
for generators that do not respond with a recommended directory path. A recommended directory is an optional field of the file
model, thereby the CLI should gracefully fallback to no directory creation.
settings:
code.create.directories: true
e.g:
---
flow:
api:
ruby_client:
- "/web/flowmisc/billing/lib/flow_commerce/flow_api_v0_client.rb"
api-internal:
ruby_client:
- "/web/flowmisc/billing/lib/flow_commerce/flow_api_internal_v0_client.rb"
So if a different user has a different project location, this might not delete all files, or might delete extra files that are needed.
when you run apibuilder update --app <whatever>
it removes any other generated files from .tracked_files
. only the file that was just updated remains tracked
Currently it does not seem to be possible to download just a single file from a given generator. See e.g. https://app.apibuilder.io/apicollective/apibuilder-generator/0.12.58/http4s_0_15
With the http4s generator I will always only need one of the generated files, never all. Sepcifying the following in the .apibuilder file gives the error below:
generators:
http4s_0_15: src/main/scala/generated/ApicollectiveApibuilderGeneratorV0ModelsJson.scala
Fetching code from https://api.apibuilder.io
apicollective/apibuilder-generator/latest/http4s_0_15...
/Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:253:in `mkdir': File exists @ dir_s_mkdir - /Code/src/main/scala/generated/ApicollectiveApibuilderGeneratorV0ModelsJson.scala (Errno::EEXIST)
from /Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:253:in `fu_mkdir'
from /Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:227:in `block (2 levels) in mkdir_p'
from /Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:225:in `reverse_each'
from /Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:225:in `block in mkdir_p'
from /Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:211:in `each'
from /Users/gheine/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/fileutils.rb:211:in `mkdir_p'
from /web/apidoc-cli/bin/apibuilder:371:in `block (4 levels) in <main>'
from /web/apidoc-cli/bin/apibuilder:365:in `each'
from /web/apidoc-cli/bin/apibuilder:365:in `block (3 levels) in <main>'
from /web/apidoc-cli/bin/apibuilder:360:in `each'
from /web/apidoc-cli/bin/apibuilder:360:in `block (2 levels) in <main>'
from /web/apidoc-cli/bin/apibuilder:359:in `each'
from /web/apidoc-cli/bin/apibuilder:359:in `block in <main>'
from /web/apidoc-cli/bin/apibuilder:358:in `map'
from /web/apidoc-cli/bin/apibuilder:358:in `<main>'
needs to run rspec test/spec/lib/*
Or does it always have to connect to the website?
Need a way to download a zip file, for example from here: http://apidoc.me/gilt/checkout-api/latest/android_client (generator takes ~2 minutes to warm up on lambda, so if you get an error on that page - try again after ~2 minutes)
According to the apibuilder documentation, you should be able to use the env var APIBUILDER_API_URI
to override the API that is hit
$ brew install apibuilder-cli
==> Downloading https://github.com/apicollective/apibuilder-cli/archive/0.1.25.tar.gz
Already downloaded: /Users/gary/Library/Caches/Homebrew/apibuilder-cli-0.1.25.tar.gz
==> ./install.sh /usr/local/Cellar/apibuilder-cli/0.1.25
๐บ /usr/local/Cellar/apibuilder-cli/0.1.25: 19 files, 305.6KB, built in 2 seconds
$ apibuilder
/usr/local/bin/apibuilder:68:in `load': cannot load such file -- /usr/local/bin/../src/apibuilder-cli.rb (LoadError)
from /usr/local/bin/apibuilder:68:in `<main>'
There seem to be two loads of the above file:
load File.join('/usr/local/Cellar/apibuilder-cli/0.1.25/src/apibuilder-cli.rb')
# - Upgrade the CLI to the latest version
#
load File.join(File.dirname(__FILE__), '../src/apibuilder-cli.rb')
For example:
http://apidoc.me/gilt/api-user-registration/0.0.2/play_2_x_routes used to return contents of the routes file, and with it this command...
$ /web/apidoc-cli/bin/apidoc code gilt api-user-registration 0.0.2 play_2_x_routes
... used to pull contents of routes.
But now that generators could contain multiple files, routes live at: http://apidoc.me/gilt/api-user-registration/0.0.2/play_2_x_routes/routes
and, seemingly, with this change cli command returns a listing of files
$ /web/apidoc-cli/bin/apidoc code gilt api-user-registration 0.0.2 play_2_x_routes
play_2_x_routes Files:
- routes
How can I list more than one directory for the input?
I want to tell apidoc to look in 2 directories, for example:
apidoc --input dir1/ dir2/
when executing commands - e.g. list applications gilt - if there is another page, maybe add a prompt or a note that there are more with instructions for how to get more
It's unclear to me which syntax the CLI wants me to use to filter files. It looks like it wants to support globs, but the implementation to turn a glob into a regular expression feels incomplete. At least, I could not find a way to exclude a single file by name. Since the patterns that can be used are poorly documented and feel limited by the implementation, I propose the file filter should accept a regular expression without substitution. In my case, this would allow me to exclude a single file using a negative lookahead ^(?!filename).*\.js$
.
Basically, I'm proposing this line is changed from:
file_regex = Regexp::new("^" + filename.gsub('.', '\.').gsub('*', '[^.]*').gsub('?', '[^.]?') + "$")
to:
file_regex = Regexp::new(filename)
Hi guys,
I'm trying to add a variable in the YAML file in order to reuse it in some points in the same file.
code:
org:
service-one:
version: *version
generators:
dart_2_17_json:
target: source
Running the command apibuilder update --path .apibuilder.yml
it works running it on a macOS with ruby version 2.6.10
but it doesn't work running it on a macOS with ruby version 3.1.1
.
/Users/federico/.rbenv/versions/3.1.1/lib/ruby/3.1.0/psych/visitors/to_ruby.rb:430:in `visit_Psych_Nodes_Alias': Unknown alias: version (Psych::BadAlias)
Searching I found this possible issue but I'm not sure.
https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias
Do you have any idea how I can solve it keeping the latest ruby version?
Thanks
When running apibuilder update
with a config
like below (note the same api declared with different versions) only the files for the version declared latest are downloaded:
my-api:
version: 1.0.3
generators:
- ...
my-api:
version: 2.0.0
generators:
- ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.