How the OpenAPI importer reads a document
This is the detail behind Where packages come from: what jadpo package import openapi <file> reads from a provider's OpenAPI document, what it writes, and what it leaves for you or your agent to…
This is the detail behind Where packages come from:
what jadpo package import openapi <file> reads from a provider's OpenAPI
document, what it writes, and what it leaves for you or your agent to
check.
- Where it writes. Always the app's own integration,
shared/providers/<name>/<version>/; installing another Jadpo app's package intopackages/isjadpo package add. The name and version are--as AcmeCouriers.v1, or the document's title inUpperCamelCaseand its version's major number (1.4.0isv1), or its date (2024-06-20isv2024_06_20), elsev1, as for a Jadpo application, whose document's version is a hash of its record. - What it reads. OpenAPI 3.0 and 3.1 as JSON, from a local file. YAML
and Swagger 2.0 are refused with what to do (
cli.package_unreadableandcli.package_not_openapi, listed under Command errors). Nothing is fetched. - The files.
package.jadpowithLicence.proprietary(an own integration may use it) andjadpo: "1.0";provider.jadpowithprotocol: Protocol.json_http,imported: { file: digest: }(the path from the project's root andsha256:of the file's bytes),hosts: { live: }from the first absolute server, andcredential: CredentialScheme.beareror.basicfrom the security schemes; a resource per tag, inresources/, every resourcepublic; the types and failures the operations reach, eachpublicin its own file, and nothing else of the description. Every operation issource: PackageSource.imported. - Operations. By path, then
get,put,post,deleteandpatch. A resource is the operation's first tag inlower_snake_case, else its path's first fixed segment that isn't a version. On the resource's shortest fixed path an operation islistorcreate; with one placeholder after itget,update(replacefor aPUTbeside aPATCH) ordelete; any other is itsoperationIdinlower_snake_case, or a Jadpo application's method and fixed segments (post_archive). Its input is its body's type when it has no placeholders or query parameters, else<Resource><Operation>Inputholding them and the body's fields; header and cookie parameters and a body that isn't JSON are left out and listed. Its output is its lowest2xxanswer's JSON body. - What it can't know from another provider is written the safe way
and listed:
changes: truefor every method butGET, noidempotent:, no failures, noidempotency:orerror_code:, and no sandbox host. - Types. The exact mappings of
Mapping imported types to standard types
(
date-timeInstant,dateCalendarDate,emailEmail,uriUrl,uuidUuid,ipv4andipv6IpAddress,byteBytes,durationDuration, and an enumeration of ISO 4217 codesCurrencyor of ISO 3166-1 codesCountry),integerInt,numberDecimal,booleanBool, an arrayList(SetwithuniqueItems), an object of one kind of valueMap<Text, V>, and their rules (minLength,maxLength,pattern,minimum,maximum,minItems,maxItems). A field notrequired, ornullable, is?. An object or enumeration inside another is a type of its own,<Parent><Field>; a constrained item of a list is a refined type,<Parent><Field>Element. A schema named as a built-in type is<Name>Type, and listed.oneOfandanyOfof several shapes, and an object of any fields, are left out and listed. Shape and name detection is under "Shape and name detection". - A Jadpo application's document (one whose operations carry
x-jadpo-changes) is read exactly: each field's type fromx-jadpo-constraints,changes:fromx-jadpo-changes,idempotent: truewhere a key keeps the response, the provider'sidempotency:fromx-jadpo-idempotency,error_code: "error.code", its failures fromx-jadpo-failure(named from the code, with its kind and message), no host (the connection giveshost:), and no finding. Its runtime's own routes (x-jadpo-generated: the exchange, passkeys, the served document) are left out. An API that signs callers in only with a browser session gets no credential, and a finding. - Importing again merges one declaration and one member at a time:
what the description adds is added, what both have is kept as the file
has it, so corrections survive, and what only the file has is kept and
listed; only
imported:is always the description's. A file that doesn't read is left alone and listed. - The summary says what was written where and counts what the package
holds, lists a merge's changes, and groups what is left to check by
what to do, each
(agent), with--jsonfor agents. - Field and variant names on the wire. A field or variant is the
provider's name in
lower_snake_case; where that differs (collectAt,after-noon, ortypewrittentype_valueto avoid a reserved word), the importer writes the provider's spelling as the field's or variant'swire_name:(Decoding).
Importing Smithy, Postman, HAR and
.d.tsisn't built yet: each istoolchain.not_built_yet.
PreviousTwo versions side by side, lazy loading and the package cacheNextHow provider calls are made
Markdown for agents: /docs/how-the-openapi-importer-reads-a-document.md.Built from Jadpo main at a707efb.