Repository navigation
feat: forward durationWeeks from course.json to the deploy payload - #33
Merged
Merged
Conversation
The validate step rewrites the deploy payload from its pydantic Course model, so any field the model does not declare is silently dropped before the create/update request. That blocked the new optional durationWeeks field (an author-declared course length in weeks) that qBraid/qbraid-api now accepts. Declare the field on the model with the same bounds the API enforces (integer, 1 to 52), so a bad value fails the validate step with a clear message instead of a 400 at deploy time. A course.json without the field keeps today's behavior: the key is removed from the payload rather than sent as null, which the API would reject. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
qbraid-api now treats an explicit null the same as an absent field, so the payload no longer needs the key stripped before posting: dump the model as-is and drop the course_payload helper. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pydantic's lax mode turned "3" into 3 and forwarded it, where the qBraid API's validator rejects a string with 400. strict=True makes the action fail the same input at validation time with a field-level message, which is what the changelog already promised. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Member
|
Ran this branch for real from a qBraid-tutorial workflow into the pr-741 preview API (create and update mode) and locally against 0, 53, 2.5, Unrelated but you will hit it: the documented "Stage 0: validate API key" is not wired into |
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.
Summary of changes
qBraid/qbraid-api#1135 adds an optional
durationWeeksfield (author-declared course length in weeks, integer 1 to 52) to the course document. This action was silently dropping it: the validate step rewrites the deploy payload viaCourse.model_dump(), and pydantic ignores fields the model does not declare, so nothing extra incourse.jsonever reached the API.Coursemodel gainsdurationWeeks: Optional[int] = Field(None, ge=1, le=52)— the same bounds the API enforces, so a bad value fails validation with a clear field-level message instead of a 400 at deploy time.course.jsonwithout the field serializes it asnull, and qbraid-api#1135 treats an explicitnullthe same as an absent field, so no key-stripping is needed here.null; 0, -3, 53, 2.5 and "two" fail validation.Validation run: full unit suite (171 passed, rerun after the null simplification),
make format-check(clean).make lint-checkfails identically on unmodifiedmain(pre-existing findings in untouched files; none introduced here).Coordinated PRs
upload-course-action@main. No Thailand-side change needed once this merges.Merge order: qbraid-api#1135 first, then this, then deploy the courses. Violations degrade gracefully: this PR before the API change forwards a field the API strips; specs deployed before this PR keep today's guessed labels.
🤖 Generated with Claude Code