Skip to content

[BUG] Cant create owned collections using the SDK #15

@DappaDanDev

Description

@DappaDanDev

It seems that requests when using the createCollection method is incorrectly routing requests. Instead of sending to:

  • Expected: POST /v1/collections (for CreateCollectionRequest)
  • Actual: POST /v1/data/owned (for CreateOwnedDataRequest)

I am following the correct structure using CreateCollectionRequest DTO
2. Error path proves misdirection - data[0].owner/schema comes from CreateOwnedDataRequest validation
3. API endpoints are different - collections vs data endpoints serve different purposes

The API receives the collection request at the data endpoint and tries to validate it as:

  CreateOwnedDataRequest {
    owner: Did,                    // ← Expected at data[0].owner
    collection: z.uuid(),
    data: z.array(z.record(...)),  // ← Our collection object ends up here
    acl: AclDto
  }

But the collection object has:

  CreateCollectionRequest {
    _id: z.uuid(),        // ← Gets put in data[0]
    type: "owned",        // ← Causes owner validation to fail
    name: string,
    schema: {...}         // ← Causes schema validation to fail (expects record)
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions