From 2ed1190f0f021bc4de17b47d8d4ed7241611d6f1 Mon Sep 17 00:00:00 2001 From: Murilo Ijanc Date: Mon, 27 Jul 2026 20:35:12 -0300 Subject: Carry the municipality of a CEP that does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A CEP that fails is rarely random: it is someone who knows the city and guessed the number, most often the -000 that 957 municipalities never received. The API now answers that 404 with the municipality owning the band the CEP falls in, and without it every caller can say no more than "does not exist" to a person who is one digit away from the right CEP. It lands on the condition rather than in a return value because it is context for the failure and nothing else: the answer is still a 404, and a faixa must never read as an address that resolved. Parsing it is deliberately defensive for the same reason — a missing, malformed or empty block yields NIL, so a field that only adds context cannot turn a clean not-found into a parse failure, and an older API stays supported. The ends of the band are the CEPs that actually exist, not the bounds the Correios publish, and the band is sparse; the docstrings and the README say so, because presenting the pair as a range of valid CEPs is the mistake this data invites. models is compiled before errors so the report function can name the faixa's municipality. --- cepis.asd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cepis.asd') diff --git a/cepis.asd b/cepis.asd index 7813f59..a6e076e 100644 --- a/cepis.asd +++ b/cepis.asd @@ -1,5 +1,5 @@ (defsystem "cepis" - :version "0.1.0" + :version "0.2.0" :author "Murilo Ijanc " :license "ISC" :description "Client for the public CEP API at cep.is." @@ -8,8 +8,8 @@ :serial t :components ((:module "src" :components ((:file "package") - (:file "errors") (:file "models") + (:file "errors") (:file "csv") (:file "client")))) :in-order-to ((test-op (test-op "cepis/tests")))) -- cgit v1.3