Skip to content

OpenConceptLab/ocl_issues#2295 | POST concepts with mappings#818

Merged
snyaggarwal merged 2 commits intomasterfrom
issues#2295
Feb 18, 2026
Merged

OpenConceptLab/ocl_issues#2295 | POST concepts with mappings#818
snyaggarwal merged 2 commits intomasterfrom
issues#2295

Conversation

@snyaggarwal
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@filiperochalopes filiperochalopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we have two simple outstanding issues: one that could lead to the concept being incorrectly persisted, even in the case of an error that doesn't trigger the exception we have in place, and another related to the content mappings required for this use case. Do we need from_concept_url within the mappings for this use case?

Comment thread core/concepts/serializers.py Outdated
Comment thread core/concepts/models.py
any_with_errors = False
if mappings and self.id:
user = self.created_by
for mapping_data in mappings:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The absence of specific mapping validation here can trigger a 500 error with a TypeError, preventing the rollback and persisting the concept even in the event of a payload failure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_create_mapping_from_self is under try/catch block.
this calls Mapping.persist_new which runs validation based on repo validation schema.
if there are any errors in mapping creation they populate errors here in catch block or down below when serializing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, _create_mapping_from_self is within a try-catch block, but the error in for mapping_data in mappings is not caught if it's not an expected list. However, the initial validation that was performed already resolves this by returning a 400 error beforehand. Thanks

Comment thread core/concepts/models.py
Comment thread core/concepts/models.py Outdated
Copy link
Copy Markdown
Contributor

@filiperochalopes filiperochalopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@snyaggarwal snyaggarwal merged commit 6a67ea5 into master Feb 18, 2026
5 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in CIEL-OCL 2026 Part 1 Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants