fix(create): send schema with resource_create by luccasmmg · Pull Request #28 · datopian/datastore · GitHub
Skip to content

fix(create): send schema with resource_create - #28

Open
luccasmmg wants to merge 1 commit into
mainfrom
fix/create-resource-with-schema
Open

luccasmmg wants to merge 1 commit into
mainfrom
fix/create-resource-with-schema

Conversation

@luccasmmg

Copy link
Copy Markdown
Member

Problem

datastore_create with a new resource dict and ingestion_mode: upsert always fails with CKAN denied resource_create.

The service creates the CKAN resource without a schema and only adds it afterwards via resource_patch. ckanext-neso validates upsert resources at create time and rejects them when schema.primaryKey is missing, so the create never gets that far.

Fix

Include the schema the service already built in the resource_create call. The post-write sync is unchanged; it patches the same schema, so aircan's upsert type-change guard doesn't fire.

Reproduced on dev (api.dev.neso.energy) during UAT. A resource created with the same typed schema passes both CKAN checks there, and the upsert flow works end to end.

CKAN may validate the schema when the resource is created: ckanext-neso
rejects an upsert resource without schema.primaryKey. The schema was only
added by the post-write resource_patch, so datastore_create with a new
upsert resource always failed with 'CKAN denied resource_create'.
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant