Skip to content
Back to skills

Skmtc Lang Ruby

ASecurity

The Ruby target-language layer for Skmtc generators (@skmtc/lang-ruby). It covers the projection base factories, RubySnippet, the register shape with requires and autoloads, the four identifier kinds, one folder as one module, the head and value render model, methods as members of a class, values that can be nil, and the producers for bodies, methods, calls, blocks, hashes, paths, constants, YARD tags and names. Use ALONGSIDE skmtc-generator whenever a generator writes Ruby.

  • 20 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
developmentgorubyexpressgitapidatabasedocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add skmtc/skmtc --skill skmtc-lang-ruby --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Skmtc Lang Ruby?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Skmtc Lang Ruby
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/skmtc-skmtc-lang-ruby/badge)](https://www.skillsdirectory.com/skills/skmtc-skmtc-lang-ruby)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: skmtc-lang-ruby
version: 0.4.0
description: >
  The Ruby target-language layer for Skmtc generators (@skmtc/lang-ruby).
  It covers the projection base factories, RubySnippet, the register
  shape with requires and autoloads, the four identifier kinds, one
  folder as one module, the head and value render model, methods as
  members of a class, values that can be nil, and the producers for
  bodies, methods, calls, blocks, hashes, paths, constants, YARD tags and
  names. Use ALONGSIDE skmtc-generator whenever a generator writes Ruby.
metadata:
  internal: true
---

# The Ruby layer (@skmtc/lang-ruby)

Read `skmtc-generator` first. There are two worked examples:

- `@skmtc/gen-ruby-data` is a model generator.
- `@skmtc/gen-ruby-faraday` is an SDK. It has an Index for each service,
  and an accumulator for the module of the services.

Generated code targets Ruby 3.2 or later. The style of both follows
`workos/workos-ruby` (see "The reference SDK").

## 1. Declare the language

The import graph declares the language. `src/base.ts` imports a factory,
and each snippet extends `RubySnippet`. Import each module by its own
path, and not from the package root.

```ts fragment
import { RubyName } from '@skmtc/lang-ruby/RubyName'
import { toRubyModelProjectionBase } from '@skmtc/lang-ruby/toRubyModelProjectionBase'

export const RubyDataBase = toRubyModelProjectionBase<EnrichmentSchema>({
  id: denoJson.name,
  toIdentifierName({ ref }) {
    return new RubyName(toModelName(ref)).toConstant()
  },
  toIdentifierType(ref, context) { … },
  toExportPath({ ref, enrichments, variant }) {
    const name = this.toIdentifierName({ ref, enrichments, variant })

    return `@/models/${new RubyName(name).toFileName()}.rb`
  },
})
```

The factories are `toRubyModelProjectionBase`,
`toRubyOasOperationProjectionBase` and `toRubyOasOperationIndexBase`.

## 2. A folder is a module

Every file is in the root module of the project. Each folder below the
project's `basePath` is one more module, inside the module of the folder
above it.

- **The root module comes from `basePath`.** `'@/'` is the project's
  `basePath`: `./lib/pet_store` gives `module PetStore`. A folder with no
  letter and no digit in its name gives `module Api`
  (`RubyRootNamespace`).
- **A folder gives a module.** `@/models/pet.rb` declares
  `PetStore::Models::Pet` (`RubyNamespace`). `RubyFile` writes one
  `module` line for each.
- **A file reads a constant of its own folder by the name alone, and a
  constant of another folder through the modules of that folder.**
  `new RubyConstantRef({ name, path, from })` writes the right form:
  `Pet` in a file of `models`, and `Models::Pet` in a file at the top.
  Never write the name of a model into a template by itself.
- **Use folders to keep names apart.** Models are in `models`, so a
  component `Error` is `Models::Error`. It is not the hand-written
  `Error` of the root module.
- **Read a constant of Ruby itself from the top.** Generated code is
  inside the modules of the project, where a model can have the name
  `Data`, `Time` or `File`. `new RubyTopConstant('Time')` writes
  `::Time`.
- **Each name is in its whole module.** `toNameScope` gives the folder,
  so the engine gives the second model of one name a counter.
- **Two files of one module can declare one name, and the engine does
  not see it.** A file knows its own definitions only. Ruby then keeps
  the last assignment of the constant, and gives a warning.

## 3. Register

| Caller | Call | File |
|---|---|---|
| Projection | `this.register(args)` | Its own export file |
| Projection | `this.registerInto(path, args)` | The file you name |
| Snippet | `this.register({ ...args, destinationPath })` | The file you name |

`args` is `{ imports?, definitions?, custom? }`. There is no `reExports`.

- A library is its name: `imports: ['time']`. The file renders
  `require "time"` at its top, sorted.
- A constant of another file of the project is
  `{ path: '@/models/address.rb', name: 'Address' }`. The file renders
  `autoload :Address, ::File.expand_path("address.rb", __dir__)`, in the
  module of the constant. For a constant of another folder, the file
  opens the module of that folder first:

  ```ruby
  module PetStore
    module Models
      autoload :Pet, ::File.expand_path("models/pet.rb", __dir__)
    end

    class PetsService < Service
  ```

  The engine registers this form for an inserted model. A generator
  writes it only for a definition that it registers itself (an inline
  class), and for a constant of a hand-written file
  (`{ path: '@/client.rb', name: 'Service' }`).
- A file with imports and no definition is a file of `autoload` lines.
  `gen-ruby-data` registers each model into `models.generated.rb` in
  this way, so a program loads one file and reads any model.
- The producer that writes a name of a library registers its import, in
  its constructor.
- With no `custom`, a file has the line
  `# Code generated by Skmtc. DO NOT EDIT.` below
  `# frozen_string_literal: true`.

### Why `autoload`

Two models can refer to each other. Two files that `require` each other
give a warning, and the second one runs before the first is complete. An
`autoload` loads its file the first time that code reads the constant.
Generated code reads a model inside a method, after both files are
complete. So a cycle needs no code of its own: no lazy reference, and no
order of files.

## 4. Identifier kinds

| Kind | Factory | Renders |
|---|---|---|
| `constant` | `createConstant(name)` | `Pet = ` + value |
| `class` | `createClass(name, { superclass? })` | `class NotFound < Error` + value |
| `module` | `createModule(name)` | `module PetStatus` + value |
| `method` | `createMethod(name)` | `def list_pets` + value |

- A class that a call makes (`::Data.define(…)`, `::Struct.new(…)`) is
  the value of a `constant`.
- The superclass of a `class` is the `typeName` of its identifier.
- Ruby has no keyword that exports a name, so `exported` and `noExport`
  render nothing.

## 5. Head and value

The identifier renders the head of a declaration, and the value renders
all that follows. The value of a `module` or a `class` is a `RubyBody`,
which renders its statements one level deeper and the `end`.

The value of a `method` is a `RubyMethodValue`, which renders the
parameters, the statements and the `end`.

**A comment is above its declaration**, where the value cannot write it.
A definition reads the `description` field of its value:

```ts fragment
export class RubyDataProjection extends RubyDataBase {
  value: RubyDataClass | RubyDataEnum
  description: Stringable | undefined
  …
}
```

The description is a string, or a producer that renders the comment. Use
a producer for a comment with YARD tags. The definition renders it with
the file, so a type in a tag is a producer too (`MethodDocumentation` in
`gen-ruby-faraday`, `RubyDataClassDocumentation` in `gen-ruby-data`).

**Only `toString()` writes target code.** A constructor stores
producers and facts: a name, a path, a flag. For a piece of Ruby syntax,
use a producer of section 9. `'nil'` is `new RubyNil()`, and
`hash["id"]` is `new RubyHashRead({ receiver, key })`.

## 6. A method is a member of a class

Ruby declares a method inside its class. An Index is the class, and its
members are the methods:

```ts fragment
// base.ts
export const ServiceBase = toRubyOasOperationIndexBase<EnrichmentSchema>({
  id: denoJson.name,
  toIdentifierName: ({ operation }) => new OperationService(operation).className,
  toIdentifierType: () => ({ type: 'class', typeName: 'Service' }),
  toExportPath: ({ operation }) => new OperationService(operation).path,
})

export const ServiceMethodBase = toRubyOasOperationProjectionBase<EnrichmentSchema>({
  id: denoJson.name,
  toIdentifierName: ({ operation, variant }) => …,
  toIdentifierType: () => ({ type: 'method' }),
  toIndex: () => Service,
})

// In the constructor of the Index:
this.body = new RubyBody(this.definitions)
```

Both bases are in `base.ts`. `base.ts` then imports `Service.ts` for
`toIndex`, and `Service.ts` imports `base.ts` for its base. The class
`Service` needs its base when its file loads, so `Service.ts` must load
first. The entry has `import './Service.ts'` as its first import for
this.

Give `RubyBody` the `definitions` array of the Index itself: the methods
arrive after the constructor, and the body reads the array when it
renders. A member projection states `toIdentifierType: () => ({ type:
'method' })` and `toIndex: () => TheIndex`, and no `toExportPath`. An
Index holds methods only: any other member stops the run.

The file of a member is the file of its Index. A member that inserts a
model gets the `autoload` of the model in that file.

## 7. A value that can be nil

Ruby reads an absent key and `null` as `nil`. Decide `nilable` in one
class (`RubyDataPresence` in `gen-ruby-data`), and give it to the
producer that writes the form:

- `RubySend({ subject, nilable, method })` and `RubyBlockCall` write
  `items.` or `items&.` before the method (`RubyReceiver`).
- `RubyGuarded({ subject, value, nilable })` writes
  `hash["at"] && ::Time.iso8601(hash["at"])`, or the value alone for a
  subject that cannot be `nil`.
- `RubyYardNilable({ type, nilable })` writes `Time, nil` or `Time`.
- `RubyFallback({ subject, fallback })` writes `(hash["tags"] || [])`.
  Use it for an array or a map that the document requires: a server can
  send `null` for it.

Do not give a boolean a default with `||`. A real `false` would become
the default.

## 8. Indentation

Ruby code uses two spaces for each level. A producer renders its own
lines from column 0. `RubyBody`, `RubyArguments`, `RubyHash`,
`RubyArray` and `RubyIndented` are the only code that writes the spaces,
so bodies nest to any depth. Do not write an indent in a template.

A producer does not wrap a long line. A project sets
`settings.formatter` to a formatter such as `"rubocop -A"`.

## 9. Producers

| Producer | Renders |
|---|---|
| `RubyList.toArguments(items)`, `.toLines`, `.toEntries`, `.toParagraphs` | `a, b`, one item on each line, the same with a comma, a blank line between items |
| `RubyLateList(items, { separator })` | A list that reads its array when it renders |
| `RubyBody(statements, { separator? })` | The statements one level deeper, then `end`. It follows a head |
| `RubyDoBlock(statements)` | `do`, the statements, `end` |
| `RubyMethod({ name, singleton?, parameters?, statements, documentation? })` | `def as_json` … `end`, or `def self.from_hash`, with its comment above. No parentheses for no parameter |
| `RubyMethodValue({ parameters?, statements, separator? })` | What follows the name of a method: `(id:, limit: nil)`, the statements and `end`. The value of a `method` definition |
| `RubyKeywordParameter({ name, defaultValue? })` | `id:`, or `notes: nil` |
| `RubyPositionalParameter({ name, defaultValue? })` | `id`, or `body = nil` |
| `RubySplat(name?)`, `RubySuper()`, `RubyNil()` | `*args` or `*`, `super`, `nil` |
| `RubyPathTemplate({ path, values? })` | `"pets/#{escape(pet_id)}"` for `/pets/{petId}`, with no leading slash, and `.placeholders` (`['petId']`). `values` has the Ruby expression of each name |
| `RubyArguments(values)`, `RubyInlineArguments(values)` | `(` one argument on each line `)`, and `(a, b)` on one line |
| `RubyCall({ name, arguments })` | A call with no receiver: `new(…)`, `escape(id)` |
| `RubySend({ subject, nilable?, method, arguments? })` | A call on a receiver: `Pet.from_hash(item)`, `at&.iso8601`, `@client.request(…)` |
| `RubyBlockCall({ subject, nilable?, method, parameter, body })` | `items.map { \|item\| item.as_json }` |
| `RubyGuarded({ subject, value, nilable })` | `subject && value`, or the value alone |
| `RubyFallback({ subject, fallback })` | `(hash["tags"] \|\| [])` |
| `RubyTernary({ condition, whenTrue, whenFalse })` | `(pet.respond_to?(:as_json) ? pet.as_json : pet)` |
| `RubyCase({ subject, branches, fallback })`, `RubyWhen({ value, result })` | `(case pet["kind"] when "cat" then Cat.from_hash(pet) else pet end)`, on one line |
| `RubyString(text)` | `"shipTo"`: a string of the document as a Ruby string |
| `RubyKeywordArgument({ name, value })` | `id: hash["id"]` |
| `RubyHash(pairs)`, `RubyPair({ key, value })` | `{ "id" => id }` with one pair on each line. The key is written as a string literal |
| `RubyHashRead({ receiver, key })` | `hash["shipTo"]` |
| `RubyArray(items)` | `[` one item on each line `]` |
| `RubyLocal(name)`, `RubyInstanceVariable(name)` | `item`, `@client` |
| `RubyAssignment({ target, value })`, `RubyMemoized({ name, value })` | `response = …`, `@pets \|\|= …` |
| `RubyTopConstant(name)` | `::Time` |
| `RubyConstantRef({ name, path, from })` | `Pet`, or `Models::Pet` from another folder |
| `RubyNestedConstant({ owner, name })` | `Order::Gift` |
| `RubySymbol(name)` | `:name` |
| `RubyYardParam`, `RubyYardReturn`, `RubyYardAttribute` | `@param id [String] The id.`, `@return [Pet]`, `@!attribute [r] id` with its `@return` below |
| `RubyYardArray(items)`, `RubyYardHash(values)`, `RubyYardNilable({ type, nilable })` | `Array<Pet>`, `Hash{String => Pet}`, `Pet, nil` |
| `RubyYardUnion(types)` | `Cat, Dog`. It writes a type that two members give once |
| `RubyComment(text)` | `# text` on each line, or nothing |

An item that is `undefined` or `null` is absent. `RubyBody` and
`RubyLateList` read their array when they render.

## 10. Names and literals

- `new RubyName(text).toConstant()` for a class and a module:
  `order-item` gives `OrderItem`, and an acronym stays in capitals
  (`HTTPClient`). `.toScreaming()` for a constant that holds a value:
  `IN_STOCK`. `.toSnake()` for a method, a parameter and a variable:
  `shipping_address`. `.toFileName()` for a file: `order_item`. Each
  form is a valid Ruby name for any text.
- `toSnake()` adds an underscore to the end of a keyword (`class_`,
  `end_`). A name that would start with a digit starts with `x_`. Ruby
  keeps `_1` to `_9` for the parameters of a block.
- Digits keep the small letters that come after them: `2nd line` gives
  `x_2nd_line`, and `3d_model` gives `x_3d_model`.
- `.toMember()` is for a member of a value. It is `toSnake()`, with one
  more rule. A name that every Ruby object or `Data` value has as a
  method gets an underscore at its end (`rubyObjectMethods`). A member
  `class` would replace `order.class`.
- `new RubyNameScope(reserved).claim(name)` makes the names of one list
  unique. A list is the members of a class, the constants of a module,
  or the parameters of a method. Put the names that the list has itself
  in `reserved`.
- `toStringLiteral(value)` writes a string of the document as a Ruby
  string in double quotes. It escapes each `#`, so `#{…}` in a text of
  the document does not run as code. Use it for each key and each enum
  value.
- `toInlineConstantName(stackTrail, owner?)` names an inline schema from
  its place in the document: `OrderShipTo`. With the `stackTrail` of the
  class that holds it, the name is the one inside that class: `ShipTo`.
  Call it from `base.ts`, where each name of a generator is.

## 11. A declaration and a type position differ

Ruby code has no place for a type. A schema gives three things at the
place of a value, and `toString()` can render one of them:

- the YARD type, for a comment (`Array<Pet>`);
- the expression that reads the JSON value (`Pet.from_hash(item)`);
- the expression that writes it (`item.as_json`).

`gen-ruby-data` solves this as follows.

- Its router takes the two expressions that hold the value
  (`subject.json` and `subject.ruby`), as producers.
- Each producer of the router renders the YARD type in `toString()`. It
  holds the two expressions as the fields `decode` and `encode`. Its
  `converts` flag is `false` for a value that is the same in both forms.
- A producer that holds another reads those fields. So the router
  returns a type of the generator, and not core's `SchemaToValueFn`
  output.
- Ruby has no declaration for an array, a map or a number.
  `isSupported` leaves such a model out, and a reference to it renders
  the schema of the model. One class has the rule for which models have
  a declaration (`RubyDataDeclaration`).
- An inline object with properties is a class, which a member can only
  name. Inside a class, that class holds it: `Order::Gift`, declared
  below `Order` in the same file. A component cannot have that name, so
  the property `amount` of `Transfer` and a component `TransferAmount`
  never clash. The router passes the holder down (`RubyDataNest`).
- An inline object with no class around it has a file of its own. The
  body of a request is an example. The engine makes its declaration:
  the producer calls `context.insertNormalizedModel` with the name of
  `toInlineConstantName(stackTrail)`. The projection has the statics
  `schemaToValueFn` and `createIdentifier` for this.
- A generator can write values of its own: the parameters, the body and
  the response of a method. It calls the exported `toRubyDataValue`.

The engine finds the declaration of an inline schema by its name and its
file only. Two inline schemas that give one name get one class, which is
the class of the first. A check for this is the engine's job, so do not
add one to a generator.

## 12. Pitfalls

| Symptom | Fix |
|---|---|
| `uninitialized constant Orders::Models::Address` | The producer that writes the name did not insert the model or register `{ path, name }` |
| `uninitialized constant PetStore::PetsService::Pet` | A file reads a constant of another folder by its name alone. Write the name with `RubyConstantRef` |
| `undefined method 'iso8601' for class Time` | The producer that writes `::Time.iso8601` did not register `'time'` |
| `undefined method 'define' for class Orders::Models::Data` | A model has the name of a class of Ruby. Write the class with `RubyTopConstant` |
| `already initialized constant PetStore::Error` | A model is in the module of a hand-written class of the same name. Put the models in a folder of their own in `toExportPath` |
| `_1 is reserved for numbered parameter` | A name was not made with `RubyName.toSnake()` |
| `order.class` gives a string | A member has the name of a method of the value. Make the name with `RubyName.toMember()` |
| `this Index does not hold that kind of declaration` | A member of a class Index is not a `method`. Return `{ type: 'method' }` from its `toIdentifierType` |
| A class renders with no methods | `RubyBody` got a copy of `definitions`. Give it the array itself |
| `uninitialized constant …::Service` at a `class X < Service` line | The superclass is in a hand-written file. Register `{ path, name }` for it in the constructor of the Index |
| `missing keyword` on `new` | The member has no default. A member that can be absent gets `defaultValue: new RubyNil()` |
| A string of the document runs as code | The string was written into a template in quotes. Use `toStringLiteral` |
| `JSON.generate` writes `"#<data Pet …>"` | A `Data` value has no `to_json` of its own. Give the class `as_json` and `to_json` |
| A method has the class of another body as its `body` type | Two inline schemas that no class holds give one name. Move one to `components.schemas` under its own name, or change the name in a clone of the generator |
| `uninitialized constant …::OMIT` | The project does not have the hand-written `omit.rb`. Copy it from `base-files` of the generator |
| `Cannot access 'ServiceBase' before initialization` | A file loaded `base.ts` before `Service.ts`. Keep `import './Service.ts'` as the first import of the entry (section 6) |

## The reference SDK

The style of the generated Ruby follows one SDK that a vendor ships:

- **Repo:** `https://github.com/workos/workos-ruby` (gem `workos`,
  version 10.7.0, MIT license).
- **Commit read:** `9ce55ea1f27ab6e6e09e46d00d3fced8d8fa2ac7`
  (2026-11-30).

Its own generator writes the files for each API. A person wrote the
small runtime once. The code is plain Ruby with no DSL between the
reader and the code, so a generator can copy the shape.

### Conventions that the generators copy

1. One root module, and one file that a program loads. All other code is
   in files below it.
2. A component has a file of its own. The file name is the class name in
   snake case.
3. Every file starts with `# frozen_string_literal: true`. The next
   line says that a generator wrote the file.
4. A field has the snake case form of its name on the wire. The line
   that reads the field has the wire key, and so does the line that
   writes it (`hash["shipTo"]`).
5. A model reads itself from a hash, with one explicit line for each
   field. There is no reflection and no type DSL. The class of a nested
   object reads it, behind a check for `nil`.
6. An optional field and a nullable field of a response both become
   `nil`.
7. An enum is a holder of string constants in SCREAMING_SNAKE_CASE, with
   `ALL`. A field of an enum type holds the plain string. So a value
   that the server adds later does not fail. The YARD type names the
   holder of the constants.
8. An array changes each item with the class of the item. An array that
   the document requires falls back to `[]` for `null`, and a map to
   `{}`. The types are in YARD form: `Array<String>`,
   `Hash{String => String}`.
9. Doc comments are YARD. A method has the summary of the operation,
   and a `@param name [Type] description` for each parameter in the
   order of the signature. Then it has a `@return [Type]`. A type that
   can be `nil` is `[String, nil]`.
10. One client class has one reader for each API area, which makes its
    service on the first read (`@pets ||= …`). A service keeps the
    client in `@client`.
11. A method takes keyword arguments only. The parameters that the
    caller must give come first, and then those with the default `nil`.
12. The method escapes a path parameter and puts it into the path
    string. Query parameters are a hash with string keys, and the client
    does not send a value that is `nil`. An array in the query is one
    parameter for each item.
13. A method ends with the model of the response. A method with no
    response body returns `nil` and has `@return [void]`.
14. Errors are one base class, a class for each common status, and a
    connection error. A method never rescues. The body of an error stays
    a plain value.
15. A person writes the runtime once (`base-files/client.rb` of
    `gen-ruby-faraday`). The generator writes the files for each API.
16. A union with a discriminator is a `case` on the discriminator value,
    with a model class for each member. A value that the mapping does
    not have stays the hash. Ours needs a `mapping` in the document.
17. An object with `additionalProperties` beside its properties has one
    member for the other keys: `additional_properties`.
18. `OMIT` is the default of a value that is optional and nullable. So a
    caller can send an explicit `null`. The sentinel is in a
    hand-written file (`base-files/omit.rb`).

### Where the generators differ

Our choice is `Data.define` value classes and a Faraday client. WorkOS
has classes that can change and `Net::HTTP`.

- **A model is `Pet = ::Data.define(…)`**, with `self.from_hash` in
  place of `initialize(json)`, because `Data` owns `initialize`. A class
  with a member that can be absent gives `initialize` keyword defaults
  and calls `super`. So a caller gives only the members that it has.
- **No table of fields and no base class.** `Data` gives `to_h`, `==`,
  `inspect` and a match by pattern (`case … in`).
- **`as_json` and `to_json` write the JSON.** `Data#to_h` returns the
  members by symbol and does not go into nested values. `JSON.generate`
  writes a `Data` value as its `inspect` text with no error. So each
  class has `as_json`, with the wire names, and `to_json`. `Data#to_h`
  stays as Ruby has it.
- **`as_json` always writes a member that the document requires**, so
  it sends one that is `nil` as `null`. It leaves out any other member
  that is `nil`.
- **Models are in the module `Models`** (`PetStore::Models::Pet`), in
  the folder `models`. WorkOS has its models in the root module
  (`WorkOS::Organization`). Ours keeps a component `Error` or `Client`
  apart from the hand-written class of that name.
- **An inline object is a class that its holder holds** (`Order::Gift`),
  in the file of the holder. WorkOS has one class in each file.
- **A map of models changes each value with `transform_values`.**
  WorkOS keeps a map as a plain `Hash`.
- **An array or a map that can be absent stays `nil`.** WorkOS reads
  each one as an empty value (`|| []`). Ours does that only for one
  that the document requires.
- **`OMIT` is the default of a member of a model.** In WorkOS it is the
  default of a parameter of a method. Ours has the body of a request as
  one model. A model that a caller makes holds `OMIT` in such a member
  until the caller gives a value.
- **A union with no discriminator, or with no `mapping`, is `Object`**:
  the value as `JSON.parse` read it. The guide lists the classes of the
  members in the YARD type. Ours does not render the members, because a
  member that Ruby has no form for then stops the run. This is a limit
  of this version: see "Limits" in the README of `gen-ruby-data`.
- **A member doc is `@!attribute [r] name` with `@return [Type]`**,
  above the class. WorkOS models have almost none.
- **A date is a `Time` or a `Date`.** `::Time.iso8601` reads a `Time`,
  and `iso8601(6)` writes it with six digits of a second. WorkOS keeps
  the string.
- **The body of a request is one keyword, `body:`**, with the model as
  its type. WorkOS makes each field of the body a keyword. One keyword
  serves a body that is an object, an array or a `$ref`. A field of the
  body then cannot clash with a parameter.
- **A header parameter is a keyword** like any other parameter.
- **An enum is a `module`**, which is the usual Ruby form for a holder
  of constants. WorkOS writes a `class`.
- **Files load with `autoload`**, so there is no Zeitwerk and no table
  of inflections.
- **Faraday is the HTTP layer.** `client.rb` does not use the
  `:raise_error` middleware, so no class of Faraday is in the public
  interface. It reads `response.success?` and raises its own classes. It
  raises a `Faraday::Error` as its `APIConnectionError`.
- **A 409 raises `ConflictError`, and a status from 500 to 599 raises
  `InternalServerError`.** WorkOS raises the general `APIError` for
  both. A caller of ours can rescue a conflict or a server fault by its
  class.

### Left out of a stock generator

A stock generator has none of these:

- retries and backoff, idempotency keys, and pagination helpers;
- connection pools, logging, and options for one request;
- deprecation warnings at run time, Sorbet files, and a generated test
  suite.

A project adds what it needs to `client.rb`, or clones the generator.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.