Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ bundle:
watch_bundle:
make lint
npx swagger-cli bundle -t json -w 300 main.yaml > doc/compiled.json
# The generator renders missing examples as "null" and object params as "{ ... }",
# which mustache can't detect; rewrite them so the doc code samples are valid Ruby.
ruby:
openapi-generator-cli generate -i tmp/compiled.yaml -g ruby -o clients/ruby -c ./openapi-generator/ruby_lang.yaml
perl -pi -e "s/: (?:null|'null'|Time\.parse\('null'\))(?=[,)]\$$)/: nil/; s/\{ \.\.\. \}/{}/g" clients/ruby/docs/*.md
go:
openapi-generator-cli generate -i tmp/compiled.yaml -g go -o clients/go -c ./openapi-generator/go_lang.yaml --global-property apiTests=false,modelTests=false
go install golang.org/x/tools/cmd/goimports@v0.24.0
Expand Down
4 changes: 2 additions & 2 deletions openapi-generator/templates/ruby-client/model_doc.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Name | Type | Description | Notes
## Code Sample

```ruby
require '{{moduleName}}'
require '{{gemName}}'

instance = {{moduleName}}::{{classname}}.new({{#vars}}{{name}}: {{#isBinary}}File.new('/path/to/file'){{/isBinary}}{{^isBinary}}{{example}}{{/isBinary}}{{^-last}},
instance = {{moduleName}}::{{classname}}.new({{#vars}}{{name}}: {{#isBinary}}File.new('/path/to/file'){{/isBinary}}{{^isBinary}}{{#isString}}'{{{example}}}'{{/isString}}{{^isString}}{{#isDateTime}}Time.parse('{{{example}}}'){{/isDateTime}}{{^isDateTime}}{{{example}}}{{/isDateTime}}{{/isString}}{{/isBinary}}{{^-last}},
{{/-last}}{{/vars}})
```

Expand Down
Loading