Number and Integer Values in HTML, Schema.org, and Web APIs
How non-negative integers, Number, and Integer are defined in HTML and Schema.org, and how APIs document numeric parameters and limits.
Web platforms disagree on names and rules for numeric values, but the same questions recur: whether a value must be a whole non-negative digit string, a Schema.org Number or Integer, or a JavaScript number in an extension API. This page ties together the HTML living standard definition of non-negative integers, Schema.org property value types, and how Chrome extensions and Cloudflare document numeric fields—so you can mark up data and read API reference without mixing incompatible types.
non-negative integer: HTML string rules for whole numbers
Section titled “non-negative integer: HTML string rules for whole numbers”In HTML, a non-negative integer is not a JavaScript type; it is a string microsyntax parsers use for attributes and algorithms.
A string is a valid non-negative integer if it consists of one or more ASCII digits.
A valid non-negative integer represents the number that is represented in base ten by that string of digits.
— WHATWG, 2.3 Common microsyntaxes — Edition for Web Developers
So 0, 42, and 0042 are valid as strings (leading zeros are still ASCII digits). Values with signs, decimals, or non-digit characters are not valid non-negative integers in this sense, even if they look “numeric” in everyday language. When you validate user input or server output against HTML, match this digit-string rule rather than assuming JSON or JavaScript number parsing.
When people search “HTML integer attribute format”
Section titled “When people search “HTML integer attribute format””Authors often need to know whether to put 42 or "42" in examples. In markup, the serialized form is text; the spec’s definition is what conforming parsers use after tokenization. If documentation for a feature cites “valid non-negative integer,” treat it as one or more ASCII digits only, with the mathematical value interpreted in base ten.
Schema.org Number and Integer: property value types
Section titled “Schema.org Number and Integer: property value types”Most numeric fields in this documentation set are Schema.org properties whose expected types are listed as Number, Integer, or sometimes both plus Text. Individual property pages follow the same pattern; examples include price, latitude, episodeNumber, bestRating, numberOfBeds, and yearBuilt.
Number properties: counts, measures, and decimals
Section titled “Number properties: counts, measures, and decimals”A large share of properties expect Number only—for instance amountOfThisGood, billingIncrement, childMinAge, copyrightYear, emissionsCO2, median, ratingValue, and stepValue. In Schema.org’s type model, Number is the general numeric type (including values that may be written with decimal notation in JSON-LD or other serializations). Use Number when the property is inherently quantitative but not restricted to whole numbers—rates, ages as numbers, percentages, prices as numerals, and similar.
Integer and Text together: ordinal and edition fields
Section titled “Integer and Text together: ordinal and edition fields”Several properties allow Integer or Text, which signals that consumers should accept either a whole number or a human-readable label. Examples from the vocabulary include artEdition, clipNumber, episodeNumber, issueNumber, pageStart, pageEnd, seasonNumber, position, and volumeNumber. Integer here means discrete whole values (issue “12”), while Text covers values like "Special Issue" or "Pilot" that are not pure integers.
Number and Text together: flexible literals
Section titled “Number and Text together: flexible literals”Properties such as discount, elevation, gender (with GenderType or Text), highPrice, lowPrice, latitude, longitude, geoRadius, numberOfAirbags, price, ratingValue, version, and worstRating allow Number or Text. That pattern fits real-world data where a field might be 29.99 or "Contact for quote", or a rating might be 4.5 or "four and a half stars" in legacy markup. Prefer Number when you have a machine-comparable value; use Text only when the source truly has no reliable numeric form.
Offsets and structured numbers
Section titled “Offsets and structured numbers”Some properties accept a numeric value or a more specific type—for example startOffset and endOffset expect HyperTocEntry or Number, and endOffset mirrors that design. flightDistance and geoRadius may use Distance, Number, or Text, reflecting that distance can be modeled as a typed quantity or a plain number or string.
| Pattern | Typical use | Example properties |
|---|---|---|
Number only |
Quantities, rates, years, limits | maxValue, minValue, screenCount |
Integer, Text |
Ordinals, editions, positions | numberedPosition, seasonNumber |
Number, Text |
Money, ratings, coordinates | bestRating, latitude |
JavaScript number in Chrome extension APIs
Section titled “JavaScript number in Chrome extension APIs”Chrome extensions document many parameters and fields with the JavaScript type number, which is a double-precision float—not the same as HTML’s digit-string non-negative integer or Schema.org Integer.
current— number optional
previous— number optional— Chrome, chrome.downloads (properties on download progress)
Similar patterns appear on inspectedWindow (type number), tabGroups (groupId as number), and color tuples as [number, number, number, number] in extensionTypes. Bookmark roots use string values such as "0" for the root folder in bookmarks—an identifier serialized as text, not a Schema.org Integer.
IDs, byte arrays, and return values
Section titled “IDs, byte arrays, and return values”In Chrome Apps / platform APIs, number may denote an ID or raw binary data—for example bluetoothLowEnergy uses id as number and data as number[], and webviewTag APIs may return number. mdns documents numeric constants such as 2048. When porting mental models from Schema.org, do not assume “number” means “JSON number property”; read whether the field is an ID, a counter, a percentage in 0–1, or RGB channels.
API and platform numeric encodings (Cloudflare examples)
Section titled “API and platform numeric encodings (Cloudflare examples)”Infrastructure and product APIs often split numbers by bit width or storage role, which is stricter than Schema.org’s broad Number.
DHCP option value types
Section titled “DHCP option value types”Cloudflare WAN DHCP server options document encoded value types including fixed-width unsigned integers:
| Type | Format | Example value |
|---|---|---|
byte |
An unsigned 8-bit integer (0–255). | 1 |
short |
An unsigned 16-bit integer (0–65535). | 512 |
integer |
An unsigned 32-bit integer (0–4294967295). | 0 |
These types also include text, hex, and ip in the same table on that page. Choosing byte vs integer affects overflow and on-wire size—a number in JSON configuration must still fit the declared DHCP encoding.
Metadata and indexing: number as float
Section titled “Metadata and indexing: number as float”Cloudflare AI Search metadata defines number as “Numeric values (parsed as float)” with examples 2.5, 100, -3.14. That matches analytics-style fields rather than HTML non-negative integers or unsigned DHCP widths. Negative and fractional values are explicitly in scope here, unlike typical byte / short DHCP fields.
SQL LIMIT: integer only
Section titled “SQL LIMIT: integer only”In Basin SQL reference, LIMIT number is documented with Type: Integer only and Default: 500; LIMIT number OFFSET number uses the same integer constraint. Fractional or non-numeric limits are out of spec for this syntax—closer to Schema.org Integer than to Number.
Optional numeric parameters and rate limits
Section titled “Optional numeric parameters and rate limits”Durable Object State documents “An optional number” for a parameter—showing that platform APIs separate presence (optional) from type (number). RTKChat and RTKStore expose updateRateLimits(num, period) with both parameters typed as number, and RTKStore adds updateBulkRateLimits(num, period) with the same types. Cloudflare’s API content strategy for parameters expects documentation of default, minimum, and maximum where applicable—orthogonal to Schema.org’s type list but essential for valid API usage.
UI “number picker” vs scalar types
Section titled “UI “number picker” vs scalar types”rtk-counter is described as “A number picker with increment and decrement buttons”—a control, not a data type. Do not confuse component names with Schema.org Number or SQL integers.
Common mistakes when mixing number systems
Section titled “Common mistakes when mixing number systems”- Using JavaScript
numberrules for HTML attributes — HTML non-negative integers require a digit-only string semantics; JSparseFloatandNumber()accept more forms than HTML parsers treat as valid. - Marking ordinals as Number only — For edition or episode fields, Schema.org often allows Text; forcing integers can lose valid values like
"Director's Cut". - Putting decimals in integer-only APIs — DHCP
byte/shortand Basin SQLLIMITreject values outside their integer ranges and types. - Treating Schema.org Number as “any string” — When only Number is listed, still supply an actual numeric literal in JSON-LD where possible; Text is only allowed when the property’s expected types include it.
- Confusing bookmark
"0"with numeric zero — Chrome’s bookmark root ID is the string"0", not the number0; API examples encode identifiers as the type the reference specifies.
How providers align (where they overlap)
Section titled “How providers align (where they overlap)”HTML (WHATWG) defines validity of non-negative integer strings for the HTML parser. Schema.org classifies property values as Number, Integer, and/or Text for structured data consumers. Chrome extension reference uses JavaScript number (and occasionally string IDs). Cloudflare splits numeric configuration into byte / short / integer, metadata number (float), and SQL integer-only limits, and documents API parameters with defaults and bounds where applicable.
The common conclusion: “number” in one doc is not interchangeable with another until you know whether the context is HTML digit strings, schema value types, JS doubles, unsigned fixed-width integers, or floats in metadata. Map your value to the layer you are targeting, then use that layer’s named type and range.
How to check this on your site
Section titled “How to check this on your site”- For HTML attributes that cite non-negative integers, compare serialized values against the HTML common microsyntaxes definition (ASCII digits only).
- For JSON-LD, open the property on Schema.org (or your specific property) and confirm whether allowed types are
Number,Integer,Text, or a specialized type such asDistance. - For Chrome extensions, match your manifest and call sites to the typed fields in the Chrome extensions API reference (e.g.
numbervs string"0"for bookmark roots). - For Cloudflare DHCP options, verify each numeric value against the DHCP option value type table (
byte,short,integer) before deployment. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact wording you are asking about, and we will correct or clarify it.