fix(ncm): corrige campos tipo_ato, numero_ato e ano_ato ausentes no fallback#797
Open
felipeflfranca wants to merge 1 commit intoBrasilAPI:mainfrom
Open
fix(ncm): corrige campos tipo_ato, numero_ato e ano_ato ausentes no fallback#797felipeflfranca wants to merge 1 commit intoBrasilAPI:mainfrom
felipeflfranca wants to merge 1 commit intoBrasilAPI:mainfrom
Conversation
…allback A função parseObject assumia chaves com sufixo _ini (upstream Siscomex), mas o fallback local ncmList.json usa chaves sem sufixo. A desestruturação produzia undefined que sobrescrevia os valores corretos do spread. Agora ambas as variantes são extraídas explicitamente e o operador ?? seleciona a disponível. Closes BrasilAPI#796 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@felipeflfranca is attempting to deploy a commit to the BrasilAPI Team on Vercel. A member of the Team first needs to authorize it. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



📋 Descrição
Corrige a função
parseObjectemservices/sefaz/index.jsque produziaundefinedpara os campos
tipo_ato,numero_atoeano_atoquando o fallback local(
ncmList.json) era usado.O upstream Siscomex usa chaves com sufixo
_ini(Tipo_Ato_Ini), mas o fallbackusa sem sufixo (
Tipo_Ato). Agora ambas as variantes são extraídas e o operador??seleciona a disponível.
Possivelmente uma regressão de #583 (fixado em #585).
🎯 Tipo de Mudança
📚 Checklist de Documentação
Os campos já estavam documentados no OpenAPI, apenas não apareciam na resposta.
🧪 Checklist de Testes
npm test)Testes existentes em
tests/ncm-v1.test.jsjá cobriam esses campos — estavam falhando porcausa do bug. Agora passam 9/9.
💻 Checklist de Código
🚀 Checklist de Performance e Custos
🔍 Como Testar
curl https://brasilapi.com.br/api/ncm/v1/33051000— hoje retorna semtipo_ato,numero_ato,ano_atonpm test— testes do NCM passam 9/9📎 Issues Relacionadas