# com.thefibrehose.pattern

> Published by [thefibrehose.com](https://lexicon.garden/identity/did:plc:36qyhxuxgiftzh6pqo4f3pgm)

✓ This is the authoritative definition for this NSID.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:36qyhxuxgiftzh6pqo4f3pgm/com.thefibrehose.pattern)
- [Documentation](https://lexicon.garden/lexicon/did:plc:36qyhxuxgiftzh6pqo4f3pgm/com.thefibrehose.pattern/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:36qyhxuxgiftzh6pqo4f3pgm/com.thefibrehose.pattern/examples)

## Definitions

### `com.thefibrehose.pattern`

**Type**: `record`

Structured metadata for a knitting/crochet pattern. The PDF itself lives either as a paired com.thefibrehose.pdf record (subject) or on thefibrehose's own backend (privatePdfId) - exactly one of the two must be set, enforced client-side only since atproto lexicon cannot express cross-field conditionals (same precedent as the yardage/meterage pair below).

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `attributes` | `array` | No | Freeform descriptive tags, e.g. textured, colorwork, top-down. |
| `colorCount` | `integer` | Yes | Number of distinct yarn colors used in the pattern. |
| `craftType` | `string` | Yes | Whether this is a knitting, crochet, or other pattern. |
| `createdAt` | `string` (datetime) | Yes | Timestamp when this pattern record was created. |
| `difficulty` | `integer` | No | Optional difficulty rating, 1 (easiest) to 10 (hardest). |
| `hookSizeMm` | `string` | No | Recommended crochet hook size in millimeters (e.g. "5.0"). Relevant only when craftType is crochet. A string because atproto lexicon has no decimal numeric type. |
| `language` | `string` (language) | Yes | BCP-47 language tag the pattern is written in (e.g. "en", "en-US"). |
| `meterage` | `integer` | No | Yarn requirement in meters. Computed alongside yardage from whichever unit the uploader entered. |
| `name` | `string` | Yes | The pattern's name/title, as given by the uploader. |
| `needleSizeMm` | `string` | No | Recommended knitting needle size in millimeters (e.g. "4.5"). Relevant only when craftType is knitting. A string because atproto lexicon has no decimal numeric type. |
| `pdfFileName` | `string` | Yes | The PDF's original filename, denormalized here so the list view can display it without an extra fetch regardless of where the file itself is hosted. |
| `photo` | `blob` | No | Optional photo of the finished piece. Always an atproto blob regardless of where the PDF itself is hosted. |
| `privatePdfId` | `string` | No | Opaque id of the PDF as stored on thefibrehose's own access-controlled backend, when the PDF is not stored as an atproto blob. Mutually exclusive with subject; exactly one must be present. |
| `subject` | `ref` → `com.atproto.repo.strongRef` | No | Strong ref to the linked com.thefibrehose.pdf record holding the actual file, when the PDF is stored as an atproto blob. Mutually exclusive with privatePdfId; exactly one must be present. |
| `uploaderDid` | `string` (did) | Yes | DID of the account that originally uploaded this pattern. Redundant with the record's own repo ownership today, but keeps provenance explicit and self-describing if this record is ever copied, reposted, or indexed outside its own repo. |
| `yardage` | `integer` | No | Yarn requirement in yards. Computed alongside meterage from whichever unit the uploader entered. |
| `yarnWeight` | `integer` | Yes | Craft Yarn Council standard yarn weight, 0 (Lace) to 7 (Jumbo). |

## Raw Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Structured metadata for a knitting/crochet pattern. The PDF itself lives either as a paired com.thefibrehose.pdf record (subject) or on thefibrehose's own backend (privatePdfId) - exactly one of the two must be set, enforced client-side only since atproto lexicon cannot express cross-field conditionals (same precedent as the yardage/meterage pair below).",
      "key": "tid",
      "record": {
        "properties": {
          "attributes": {
            "description": "Freeform descriptive tags, e.g. textured, colorwork, top-down.",
            "items": {
              "maxLength": 64,
              "type": "string"
            },
            "maxLength": 30,
            "type": "array"
          },
          "colorCount": {
            "description": "Number of distinct yarn colors used in the pattern.",
            "minimum": 1,
            "type": "integer"
          },
          "craftType": {
            "description": "Whether this is a knitting, crochet, or other pattern.",
            "enum": [
              "knitting",
              "crochet",
              "other"
            ],
            "type": "string"
          },
          "createdAt": {
            "description": "Timestamp when this pattern record was created.",
            "format": "datetime",
            "type": "string"
          },
          "difficulty": {
            "description": "Optional difficulty rating, 1 (easiest) to 10 (hardest).",
            "maximum": 10,
            "minimum": 1,
            "type": "integer"
          },
          "hookSizeMm": {
            "description": "Recommended crochet hook size in millimeters (e.g. \"5.0\"). Relevant only when craftType is crochet. A string because atproto lexicon has no decimal numeric type.",
            "maxLength": 16,
            "type": "string"
          },
          "language": {
            "description": "BCP-47 language tag the pattern is written in (e.g. \"en\", \"en-US\").",
            "format": "language",
            "type": "string"
          },
          "meterage": {
            "description": "Yarn requirement in meters. Computed alongside yardage from whichever unit the uploader entered.",
            "minimum": 0,
            "type": "integer"
          },
          "name": {
            "description": "The pattern's name/title, as given by the uploader.",
            "maxLength": 200,
            "type": "string"
          },
          "needleSizeMm": {
            "description": "Recommended knitting needle size in millimeters (e.g. \"4.5\"). Relevant only when craftType is knitting. A string because atproto lexicon has no decimal numeric type.",
            "maxLength": 16,
            "type": "string"
          },
          "pdfFileName": {
            "description": "The PDF's original filename, denormalized here so the list view can display it without an extra fetch regardless of where the file itself is hosted.",
            "maxLength": 1024,
            "type": "string"
          },
          "photo": {
            "accept": [
              "image/png",
              "image/jpeg",
              "image/webp"
            ],
            "description": "Optional photo of the finished piece. Always an atproto blob regardless of where the PDF itself is hosted.",
            "maxSize": 5242880,
            "type": "blob"
          },
          "privatePdfId": {
            "description": "Opaque id of the PDF as stored on thefibrehose's own access-controlled backend, when the PDF is not stored as an atproto blob. Mutually exclusive with subject; exactly one must be present.",
            "maxLength": 64,
            "type": "string"
          },
          "subject": {
            "description": "Strong ref to the linked com.thefibrehose.pdf record holding the actual file, when the PDF is stored as an atproto blob. Mutually exclusive with privatePdfId; exactly one must be present.",
            "ref": "com.atproto.repo.strongRef",
            "type": "ref"
          },
          "uploaderDid": {
            "description": "DID of the account that originally uploaded this pattern. Redundant with the record's own repo ownership today, but keeps provenance explicit and self-describing if this record is ever copied, reposted, or indexed outside its own repo.",
            "format": "did",
            "type": "string"
          },
          "yardage": {
            "description": "Yarn requirement in yards. Computed alongside meterage from whichever unit the uploader entered.",
            "minimum": 0,
            "type": "integer"
          },
          "yarnWeight": {
            "description": "Craft Yarn Council standard yarn weight, 0 (Lace) to 7 (Jumbo).",
            "maximum": 7,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "uploaderDid",
          "name",
          "pdfFileName",
          "craftType",
          "yarnWeight",
          "colorCount",
          "language",
          "createdAt"
        ],
        "type": "object"
      },
      "type": "record"
    }
  },
  "id": "com.thefibrehose.pattern",
  "lexicon": 1
}
```
