Skip to content

2.2.1: encode CiString character set and forbid empty tariff_id in parameters/schemas #36

Description

@juherr

Summary

The 2.2.1 OpenAPI constrains identifier length but not the character set that the normative OCPI types mandate, and the tariff_id path parameter permits an empty value. As a result, values the prose spec forbids still validate against the OpenAPI.

Normative references

  • types.asciidocCiString: "Case Insensitive String. Only printable ASCII allowed. (Non-printable characters like: Carriage returns, Tabs, Line breaks, etc are not allowed)"
  • mod_tariffs.asciidoc — Tariff object: country_code = CiString(2), party_id = CiString(3), id = CiString(36).

Gaps in the current OpenAPI

1. CiString character set is not encoded. country_code / party_id are declared as (components/parameters.yaml, modules/tariffs/schema.yaml):

type: string
minLength: 2   # 3 for party_id
maxLength: 2   # 3 for party_id

type: string is case-sensitive UTF-8 with no charset restriction, so e.g. "é" or a value containing a line break validates — although CiString allows only printable ASCII. This applies to every CiString-typed field, not just these two.

2. tariff_id path parameter allows an empty value (modules/tariffs/parameters.yaml):

TariffIdParameter:
  in: path
  name: tariff_id
  schema:
    type: string
    maxLength: 36      # no minLength -> "" is valid

An empty tariff_id is unusable as a path segment in GET/PUT/DELETE /tariffs/{country_code}/{party_id}/{tariff_id}.

Suggested fix

  • Add a pattern encoding the CiString rule (printable ASCII, no control characters), e.g. ^[\x20-\x7E]*$, to CiString-typed fields — at least to the common identifiers (country_code, party_id, id, tariff_id). The pattern must stay case-insensitive (CiString), so no [A-Z]-only regex.
  • Add minLength: 1 to TariffIdParameter (and consider Tariff.id).

Relation to existing issues

Continues the OpenAPI↔prose fidelity work in #5 (date regex), #10 (id length), #11 (currency minLength). Those did not cover the CiString character set nor the parameter layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions