StreetAddress (Semantic Module)
The StreetAddress semantic module validates, sanitizes, and standardizes primary street address lines (such as "123 Main Street" or "450 7th Ave").
It ensures that street lines consist of clean plaintext, automatically prevents malicious HTML or script tags from entering your database, converts whitespace-only inputs into clean null values, and normalizes extra padding.
Technical Specifications
Section titled “Technical Specifications”| Attribute | Specification |
|---|---|
| Scope | Property (Applied to a text property) |
| Data Type | String |
| Default Max Length | 255 characters |
| HTML Sanitization | Disallowed (Rejects HTML, script, or markup tags) |
| Whitespace Handling | Automatically trimmed; whitespace-only strings become null |
Key Capabilities
Section titled “Key Capabilities”1. Plaintext Security (HTML & Script Blocking)
Section titled “1. Plaintext Security (HTML & Script Blocking)”Physical street addresses should never contain HTML tags or embedded scripts. If a user or malicious payload attempts to inject markup (e.g., <script> or <b>123 Main</b>), the Serverless Engine immediately rejects the request with a validation error (400 Bad Request).
2. Automatic Trimming & Empty Value Normalization
Section titled “2. Automatic Trimming & Empty Value Normalization”- Trimming: Strips accidental leading and trailing whitespace introduced by copy-pasting address fields.
- Nullification: Submitting an empty string or spaces-only (
" ") automatically stores asnullrather than preserving blank ghost strings in your database.
3. Complementary Supplemental Lines (StreetAddressSupplemental)
Section titled “3. Complementary Supplemental Lines (StreetAddressSupplemental)”For address models that separate primary street lines from secondary units, the platform also provides StreetAddressSupplemental. This handles apartment, suite, floor, and unit numbers with the same sanitization and trimming standards.
API Lifecycle Examples
Section titled “API Lifecycle Examples”1. Creating a Clean Street Address
Section titled “1. Creating a Clean Street Address”A client submits a street line with surrounding whitespace:
POST /addressesContent-Type: application/json
{ "street": " 742 Evergreen Terrace "}Server Response (201 Created):
The engine normalizes the address cleanly:
{ "data": { "id": "addr_102", "street": "742 Evergreen Terrace" }}2. Validation Failure (HTML Tags Detected)
Section titled “2. Validation Failure (HTML Tags Detected)”A client submits address text containing HTML markup:
{ "street": "123 Main St <script>alert(1)</script>"}Server Response (400 Bad Request):
{ "type": "https://docs.apinow.app/errors/validation", "title": "Validation Error", "status": 400, "code": "E_VALIDATION_ERROR", "detail": "Property 'street' cannot contain HTML tags or markup."}Validation Rules & Modeling Guidelines
Section titled “Validation Rules & Modeling Guidelines”- String Properties Only: Apply
StreetAddressto aStringproperty in the Domain Modeler. - Property Length Constraints: String properties default to a Maximum Length of 255 characters, which is more than sufficient for international street names.