Skip to content

DocumentedAPIProperty doesn't work right #851

Open
@Treeed

Description

Describe the bug
When a DocumentedAPIProperty is defined, it affects only the pure json schema and that schema then only contains the newly defined properties, not the automatically generated ones. These changes don't reflect what the API actually does.

To Reproduce
Go to partdb/api and observe the schema of GET /api/attachments/{id}

The schema for application/ld+json looks like this:

{
  "@context": "string",
  "@id": "string",
  "@type": "string",
  "name": "string",
  "element": {
    "name": "string",
    "id": 0
  },
  "show_in_table": true,
  "attachment_type": "https://example.com/",
  "addedDate": "2025-02-02T16:08:37.327Z",
  "lastModified": "2025-02-02T16:08:37.327Z",
  "id": 0,
  "picture": true,
  "3d_model": true,
  "external": true,
  "private": true,
  "builtIn": true,
  "url": "string"
}

The schema for application/json looks like this:

{
  "media_url": "/media/part/2/bc547-6508afa5a79c8.pdf",
  "thumbnail_url": "string"
}

Expected behavior
The specified property should be added to all schemata and leave the autogenerated parts of each schema untouched.

Server Side

  • Part-DB Version: 1.15.2
  • PHP Version: 8.3.15
  • Database Server SQLite

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions