A release that adds a standard type
When a Jadpo upgrade adds a standard type with a name your app already
uses for a type of its own, your app never breaks silently. The first
check after the upgrade reports each clash as the error
type.standard_clash, naming the standard type and the release that
added it. Each release's notes list the names it adds. There are two
fixes:
- Swap to the standard type. This is the same swap as
type.standard_existsoffers: every reference to your type becomes a reference to the standard one, each field the shape matched is read by the standard field's name, and your declaration goes. - Rename your type, keeping its own meaning under a name of its own.
jadpo fix applies whichever you pick, through the same code as the
editor's quick fix (Editor support).
The clash is reported on every declaration named like a standard type,
whenever it was written. The checker keeps no record of the release a
project last checked with, so "the first check after the upgrade" is
every check until the clash is fixed.
For a standard type's name, type.standard_clash replaces
semantic.duplicate_declaration's "is a built-in type". A language
type's name, such as Text or Int, keeps
semantic.duplicate_declaration. The clash can't be declined, since two
declarations can't share a name, and a declaration it names is never
also type.standard_exists. While it stands, a reference to the name
means the standard type. The errors that gives are the swap's, and the
rename clears them.
jadpo fix with no arguments lists each finding it can fix.
jadpo fix <name> swap or jadpo fix <name> rename <NewName> makes one,
listing what changed file by file:
domains/rooms/types/slot.jadpo - Slot type, the standard InstantRange replaces it - slot.jadpo file, nothing left in it domains/rooms/actions/slot_of.jadpo ~ line 4 InstantRange, was Slot ~ line 5 InstantRange, was Slot ~ line 6 start, was starts_at ~ line 7 end, was ends_at✓ Swapped Slot for the standard InstantRange→ jadpo check shows the error the project still has
The swap
The swap is offered on a type only. A failure, an event, an email or an entity named like a standard type is renamed instead.
The swap deletes the declaration, with its comments and decline line,
and its file when nothing else is in it. It writes the standard type's
name at each reference in the files that can see the declaration. It
renames each field the shape matched where it is read: in a body by what
the name resolved to, elsewhere as Type.field is written. And it takes
the name out of use lines. Whether the standard type fits is decided by
checking the result, not by comparing shapes beforehand.
The rename
The rename writes the new name at the declaration and at every reference
in the files that can see it, use lines included. It moves the file
named after the declaration to the new name's file. The new name must be
an unused UpperCamelCase name that reads back from its file name, or
jadpo fix refuses it with cli.fix_arguments.
The rename belongs to jadpo fix alone and isn't a general
jadpo rename, so it writes no identity line
(database/identities.json). A rename whose result changes stored data
or an API record stops on that error. The editor offers only the swap,
since a quick fix can't ask for a name.
Naming what to fix
The name you give jadpo fix is the declaration's, as its finding names
it. A name that two domains each declare privately is refused, naming
both places.
A fix never adds an error
Each fix is checked once made. A fix whose result has an error the
project didn't have, by rule and headline, changes nothing and shows that
error. A swap to a standard enum that lacks a variant your code names is
refused this way. Errors the project already had stay, so you fix one
finding at a time even while other errors stand: jadpo check shows
them, and jadpo fix says how many findings are left. So a swap of a
type already stored or in an API record stops, until its migration and
acceptances are built.
Names each release adds
Each standard type records the release it ships in, as
major.minor.patch. Every type built before Jadpo's first release
carries 0.1.0, the workspace's version. The names each release adds,
as its release notes list them:
| Release | Standard types it adds |
|---|---|
| 0.1.0 | AbaRoutingNumber, Allergen, AltText, Angle, ApiKey, Area, AspectRatio, AudioCodec, BankAccount, Barcode, BasisPoints, BearerToken, Bearing, Bic, Bitrate, BloodGlucose, BloodPressure, BloodType, BookingReference, BoundingBox, CabinClass, CalendarDate, CalendarEvent, CalendarPeriod, CallingCode, CardBin, CardBrand, CardExpiry, Carrier, CefrLevel, Certificate, ChatMessage, ChatRole, Cidr, Circle, ClothingSize, ClothingSizeSystem, Colour, Concentration, ContainerImage, ContainerNumber, ContentRating, ContentRatingScheme, Continent, Cookie, Country, CountrySubdivision, Crs, Currency, Current, Cve, DataSize, DateRange, Digest, Dimensions, Discount, Doi, DomainName, DosageInstruction, Dose, DrivingLicenceNumber, Duration, Ean13, EastingNorthing, Email, EmailWithName, Embedding, Emoji, EncryptedValue, Energy, EpcRating, ExchangeRate, ExifOrientation, FamilyName, Feature, FeatureCollection, FileName, FilePath, FileType, FlightNumber, Fraction, FrameRate, Frequency, Geohash, Geometry, GitRef, GivenName, H3Cell, Hash, HeartRate, Hmac, Hostname, HsCode, Html, HttpHeaderName, HttpMethod, HttpStatus, IataAirline, IataAirport, Iban, IcaoAirport, Icd10Code, IdempotencyKey, IdentityDocument, IdentityDocumentKind, Illuminance, ImageDimensions, Imei, Incoterm, Insets, Instant, InstantRange, InterestRate, InterestRateBasis, InvoiceNumber, IpAddress, Isbn, Isin, IsoWeek, JsonPointer, Jurisdiction, Jwk, Jwt, JwtClaims, Language, Latitude, LawfulBasis, Lei, Length, LineString, LocalDateTime, LocalTime, Locale, LocalisedText, LogLevel, Longitude, LotNumber, MacAddress, MapTile, Markdown, MaskedCardNumber, Mass, ModelId, Money, Month, Mpan, Mprn, MultiLineString, MultiPoint, MultiPolygon, Nationality, NetworkPort, NhsNumber, OAuthScope, OidcClaims, OneTimeCode, OpeningHours, Orcid, PackageUrl, PaperSize, PassportNumber, Password, PasswordCheck, PasswordHash, PasswordPolicy, PaymentCardNumber, PaymentReference, Percentage, PersonName, PhoneExtension, PhoneNumber, Point, Polygon, PostalAddress, PostalCode, Power, Pressure, Price, ProblemDetails, PublicKey, PushToken, Quarter, Range, Rating, Ratio, Rect, RecurrenceRule, RegularExpression, RelativeUrl, RichText, RichTextBlock, RichTextMark, RichTextSpan, RouteOfAdministration, SecretText, SemanticVersion, SerialNumber, ShoeSize, ShoeSizeSystem, Sku, Slug, SnomedConcept, SoundLevel, SpanId, SpdxLicence, Speed, Sscc, SubtitleCue, TaxId, TaxRate, Temperature, TemperatureDifference, Tenure, TextDirection, Timecode, TokenCount, TokenUsage, TotpSecret, TraceId, TraceParent, TrackingNumber, UkAccountNumber, UkCompanyNumber, UkNationalInsuranceNumber, UkSortCode, UkUtr, Ulid, UnLocode, UnNumber, UnitPrice, UnitQuantity, UpcA, Uprn, Url, UrlPath, UsEin, UsSsn, UserAgent, Username, UtcOffset, UtmParameters, Uuid, VatNumber, Vector, VehicleRegistration, VersionRange, VideoCodec, VideoResolution, Vin, Voltage, Volume, WebAuthnCredential, WebOrigin, Weekday, WritingScript, Year, YearMonth, Zone, ZonedTime |
The example of type.standard_clash is under Errors. The
editor's quick fix is titled "Swap for the standard ...".
Not built yet: the migration and acceptances a swap of a stored type
needs (Records and manifest), and a general
jadpo rename (the roadmap).
Markdown for agents: /docs/standard-type-clashes.md.Built from Jadpo main at a707efb.