{ }
Resource profile / Pydantic API Model Contracts
About this skill

Workflow & requirements

BB Skills adaptation and evidence notes (2026-10-07)

Microsoft authored the original multi-model instructions, Python template and capability reference. All original source files are retained unchanged; upstream-original/SKILL.md holds the original instructions. This identified preface, packaging metadata and the independent examples are BB Skills additions, not Microsoft certification.

The Python asset contains documented resource-name placeholders and is not directly runnable until those placeholders are replaced. The independent fixture makes only those two replacements in memory. Nineteen named model-contract observations passed on Python 3.12.4 with Pydantic 2.13.5 in a disposable Windows virtual environment and separately on the existing 2.7.4 comparison environment. It checks aliases, required fields and length bounds, omitted versus explicit-null updates, upstream extra-field behavior, independent restrictive request models, merged-state validation, JSON-safe output, response projection, the storage discriminator and generated schema. Original Microsoft evaluation criteria are included for reference but the hosted harness was not executed.

The original template defaults to ignoring unknown fields. A regular update model dump includes default null values. For a project contract that needs strict rejection and partial updates, inspect examples/api_contract.py: extra="forbid", exclude_unset=True and validation after merging have different responsibilities. Ownership, permitted workspace access, concurrency and database writes remain application responsibilities. Required fields must remain valid after merging. Response projection in this synthetic fixture is not a comprehensive privacy or API security guarantee.

The pinned template uses populate_by_name=True. Pydantic's current documentation recommends validate_by_name=True and validate_by_alias=True for v2.11 and later; adapt a separate project copy and test the dependency version you pin. Source files are preserved rather than silently rewritten. The 2.7.4 run is comparison evidence, not a downgrade recommendation.

Download, source and offline examples are free and MIT-licensed. Reproduction requires Python and a separately installed Pydantic v2; runtime binaries and wheels are not bundled. No Azure account, cloud database, API key, paid model call, network request by the fixture or production data is required. The skill has not been executed by a complete AI client; runtime_tested remains false. No website API, authentication flow or production persistence was tested. See examples/README.md and native-model-evidence.json for exact environment and boundaries.

Pydantic Models

Create Pydantic models following the multi-model pattern for clean API contracts.

Quick Start

Copy the template from assets/template.py and replace placeholders: - {{ResourceName}} → PascalCase name (e.g., Project) - {{resource_name}} → snake_case name (e.g., project)

Multi-Model Pattern

Model Purpose
Base Common fields shared across models
Create Request body for creation (required fields)
Update Request body for updates (all optional)
Response API response with all fields
InDB Database document with doc_type

camelCase Aliases

from datetime import datetime

from pydantic import BaseModel, ConfigDict, Field

class MyModel(BaseModel):
    model_config = ConfigDict(populate_by_name=True)

    workspace_id: str = Field(..., alias="workspaceId")
    created_at: datetime = Field(..., alias="createdAt")

Optional Update Fields

class MyUpdate(BaseModel):
    model_config = ConfigDict(populate_by_name=True)

    name: Optional[str] = Field(None, min_length=1)
    description: Optional[str] = None

Database Document

class MyInDB(MyResponse):
    doc_type: str = "my_resource"

Integration Steps

  1. Create models in src/backend/app/models/
  2. Export from src/backend/app/models/__init__.py
  3. Add corresponding TypeScript types

Reference Files

File Contents
references/capabilities.md Additional non-hero capabilities, operation-group coverage, and production checklists.
PACKAGE TRANSPARENCY

Inspect before installing

Source: Microsoft · MIT · SHA-256 shown alongside the download.

22 files38776 ZIP bytes3 script/code files

License file included. A license and checksum are not a security certification. Review package instructions and scripts before running them.

View files and uncompressed sizes
Machine-readable installation guide →
CATALOG REVIEW NOTES

Know what you need before installing

Source and packaging checks recorded on 2026-10-07. These notes are not safety certification or measured task performance.

Requirements

Python 3 and separately installed Pydantic v2 to reproduce the offline fixture. Primary evidence uses 2.13.5; 2.7.4 is comparison only. Replace the original template placeholders when adapting a separate project copy. No Azure account or API key required for this fixture.

Costs, access & practical limits

Free MIT sources and native fixture. No paid model call, network request by the fixture or production access. Native template observations do not verify AI-client execution, authorization or full API security.

View the recorded checks
  • Pinned originals match Git blob and SHA-256
  • Both actual skill-relative references and full MIT notice retained
  • Upstream Git symlink preserved as plain source-context text
  • Nineteen observations passed on each of two explicit Pydantic versions
  • Default omitted/null and extra-input behavior documented
  • Independent patch contract revalidates merged state; production ownership and persistence untested

Upstream commit: 354361d83247c76a1c21e802e0d4887c4d8323a3

Runtime status: not tested by this catalog. Configure your client and test the skill in your own environment.

LICENSE & ATTRIBUTION

License & attribution

The notices identify their files, attribution and changes. Retain the applicable original notices when adapting or redistributing the package.

MIT ↗

Original Microsoft instructions, template, reference and retained source context

Attribution: Microsoft Corporation; unchanged source bytes and full notice retained

Changes: Identified preface added to primary skill; original retained unchanged

Included notice: pydantic-models-py/LICENSE.upstream.txt

Declared source ↗

MIT ↗

Independent BB Skills preface, contract fixture, evidence and packaging

Attribution: Copyright (c) 2026 BB Skills

Changes: Independently authored offline fixture and explicit evidence scope

Included notice: pydantic-models-py/LICENSE.bb-skills.txt

Declared source ↗
SCENARIOS

Inputs, criteria and recorded outcomes

Records are supplied by the site administrator and bound to a specific package. They are not third-party safety certification. This page does not execute skills.

Native Pydantic template and partial-update contracts

Reported passed · v354361d83247.bb1

View input and acceptance criteria

Input

Nineteen named model observations on Python 3.12.4/Pydantic 2.13.5 with a separate 2.7.4 comparison run. A pinned Microsoft template with its documented resource-name substitutions and an independent BB Skills restrictive patch example. Synthetic local inputs only; no AI-client execution, network requests, production route, authentication, database write, cloud SDK, paid model call or comprehensive security verification.

Acceptance criteria

Nineteen named native observations pass on each recorded Pydantic version. Invalid inputs are expected rejections with matching fields and error types. No general API security or full AI skill execution claim.

Recorded outcome

Nineteen named model observations on Python 3.12.4/Pydantic 2.13.5 with a separate 2.7.4 comparison run. A pinned Microsoft template with its documented resource-name substitutions and an independent BB Skills restrictive patch example. Synthetic local inputs only; no AI-client execution, network requests, production route, authentication, database write, cloud SDK, paid model call or comprehensive security verification.

Current-version evidence:
{
  "executed_at": "2026-10-07T08:18:00.026828+00:00",
  "fixture": "Pinned Pydantic template and independent partial-update contract",
  "observations": 19,
  "cases": [
    {
      "name": "create accepts documented camelCase workspace alias",
      "status": "passed"
    },
    {
      "name": "create accepts configured Python field name",
      "status": "passed"
    },
    {
      "name": "creation requires workspace identity",
      "status": "passed"
    },
    {
      "name": "empty project name rejected",
      "status": "passed"
    },
    {
      "name": "name longer than 200 rejected",
      "status": "passed"
    },
    {
      "name": "description longer than 2000 rejected",
      "status": "passed"
    },
    {
      "name": "omitted update excludes default fields",
      "status": "passed"
    },
    {
      "name": "explicit null retained in update payload",
      "status": "passed"
    },
    {
      "name": "naive default dump contains unrelated null fields",
      "status": "passed"
    },
    {
      "name": "upstream default ignores unknown fields rather than rejecting",
      "status": "passed"
    },
    {
      "name": "strict create rejects injected server-owned identity",
      "status": "passed"
    },
    {
      "name": "patch rejects changes to workspace identity",
      "status": "passed"
    },
    {
      "name": "patch keeps omitted description",
      "status": "passed"
    },
    {
      "name": "patch deliberately clears explicit description null",
      "status": "passed"
    },
    {
      "name": "merged contract rejects null for required name",
      "status": "passed"
    },
    {
      "name": "response JSON serialization uses aliases and JSON-safe dates",
      "status": "passed"
    },
    {
      "name": "attribute response projection omits undeclared synthetic field",
      "status": "passed"
    },
    {
      "name": "database model supplies its documented discriminator",
      "status": "passed"
    },
    {
      "name": "generated schema exposes required aliases and bounds",
      "status": "passed"
    }
  ],
  "python": "3.12.4",
  "pydantic": "2.13.5",
  "platform": "Windows",
  "native_template_executed": true,
  "runtime_tested": false,
  "ai_client_executed": false,
  "production_tested": false,
  "network_requests": false,
  "credentials_required": false,
  "paid_api_used": false,
  "source_hashes": {
    "assets/template.py": "bc589a21973eeca69d8f0cf08bca4671af01dec0bac2c0f1738f445392104ab3",
    "examples/api_contract.py": "8f1d9b39fb9387d9600bd9d85cbcced92d0492421751dbc3bbc71fc4bb7b225d",
    "examples/run_validation_fixture.py": "aa5848ece000416f7e1d312e9cb1d5f4ee5cc9361c14037323517a800305256b"
  }
}

Comparison evidence:
{
  "executed_at": "2026-10-07T08:16:27.563922+00:00",
  "fixture": "Pinned Pydantic template and independent partial-update contract",
  "observations": 19,
  "cases": [
    {
      "name": "create accepts documented camelCase workspace alias",
      "status": "passed"
    },
    {
      "name": "create accepts configured Python field name",
      "status": "passed"
    },
    {
      "name": "creation requires workspace identity",
      "status": "passed"
    },
    {
      "name": "empty project name rejected",
      "status": "passed"
    },
    {
      "name": "name longer than 200 rejected",
      "status": "passed"
    },
    {
      "name": "description longer than 2000 rejected",
      "status": "passed"
    },
    {
      "name": "omitted update excludes default fields",
      "status": "passed"
    },
    {
      "name": "explicit null retained in update payload",
      "status": "passed"
    },
    {
      "name": "naive default dump contains unrelated null fields",
      "status": "passed"
    },
    {
      "name": "upstream default ignores unknown fields rather than rejecting",
      "status": "passed"
    },
    {
      "name": "strict create rejects injected server-owned identity",
      "status": "passed"
    },
    {
      "name": "patch rejects changes to workspace identity",
      "status": "passed"
    },
    {
      "name": "patch keeps omitted description",
      "status": "passed"
    },
    {
      "name": "patch deliberately clears explicit description null",
      "status": "passed"
    },
    {
      "name": "merged contract rejects null for required name",
      "status": "passed"
    },
    {
      "name": "response JSON serialization uses aliases and JSON-safe dates",
      "status": "passed"
    },
    {
      "name": "attribute response projection omits undeclared synthetic field",
      "status": "passed"
    },
    {
      "name": "database model supplies its documented discriminator",
      "status": "passed"
    },
    {
      "name": "generated schema exposes required aliases and bounds",
      "status": "passed"
    }
  ],
  "python": "3.12.4",
  "pydantic": "2.7.4",
  "platform": "Windows",
  "native_template_executed": true,
  "runtime_tested": false,
  "ai_client_executed": false,
  "production_tested": false,
  "network_requests": false,
  "credentials_required": false,
  "paid_api_used": false,
  "source_hashes": {
    "assets/template.py": "bc589a21973eeca69d8f0cf08bca4671af01dec0bac2c0f1738f445392104ab3",
    "examples/api_contract.py": "8f1d9b39fb9387d9600bd9d85cbcced92d0492421751dbc3bbc71fc4bb7b225d",
    "examples/run_validation_fixture.py": "aa5848ece000416f7e1d312e9cb1d5f4ee5cc9361c14037323517a800305256b"
  }
}

Environment

Windows; Python 3.12.4; Pydantic 2.13.5 in a disposable virtual environment and separate 2.7.4 comparison. Synthetic in-memory model inputs. No credentials, network requests or production data. Original Microsoft hosted evaluation harness was not run.

Package SHA-256: 31fb3c718f0314cf964cb67d908968148958fec20f9e51178aace1ecefe26393

Outcome recorded: 2026-10-07 08:18 UTC

Open evidence ↗

Community reviews

★ New

Be the first to share your experience.

Sign in to leave a review →

Guides using this resource

All guides →
Practical guide

FastAPI API contracts: response filtering and dependency tests

Test FastAPI's public response contracts with local examples: reject invalid input, detect direct-response bypasses, isolate dependency overrides and check when yield cleanup runs.

By BB Skills · Read guide →
Practical guide

Pydantic API models: preserve partial updates and reject invalid input

A Pydantic skill can help an agent draft API models, but a working class does not settle the meaning of a partial update. This guide uses a pinned Microsoft template and a small…

By BB Skills · Read guide →
View all ↗

Links use published guide associations and catalog labels. Inspect each resource’s requirements and license.