Skip to content

[BUG]: JSON import in the data contract upload modal returns 405 Method Not Allowed #74

@GFernie

Description

@GFernie

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The Or paste ODCS JSON path in the Upload File modal does not import valid JSON contracts.

After pasting valid JSON and clicking the modal background, the UI shows Failed to import ODCS JSON. The frontend sends POST /api/data-contracts/odcs/import, and the backend responds 405 Method Not Allowed.

I verified this with:

  1. a minimal JSON contract without support
  2. a minimal JSON contract with support

Both return 405, so this issue appears independent of the separate support-field file upload bug (#73).

Also, there's no obvious trigger for submitting the JSON input. I clicked the modal background and that seems to trigger a request to the backend, but there really should be a button or something.

Expected Behavior

Pasting valid ODCS JSON into the upload modal should import the contract successfully.

Steps To Reproduce

  1. Open Ontos and go to Data Contracts.
  2. Click Upload File.
  3. Paste this JSON into Or paste ODCS JSON:
{
  "kind": "DataContract",
  "apiVersion": "v3.1.0",
  "id": "urn:datacontract:example:public:upload:control-json",
  "name": "public_upload_control_json",
  "version": "1.0.0",
  "status": "draft",
  "description": {
    "purpose": "Minimal public JSON control contract without support entries."
  }
}
  1. Click the modal background.
  2. Observe that the UI shows Failed to import ODCS JSON.
  3. Observe that POST /api/data-contracts/odcs/import returns 405 Method Not Allowed.
    Comparison:
  4. Repeat with this JSON containing support:
{
  "kind": "DataContract",
  "apiVersion": "v3.1.0",
  "id": "urn:datacontract:example:public:upload:repro-json",
  "name": "public_support_upload_repro_json",
  "version": "1.0.0",
  "status": "draft",
  "description": {
    "purpose": "Minimal public JSON repro for Ontos contract upload failure."
  },
  "support": [
    {
      "channel": "#support-example",
      "tool": "slack",
      "scope": "technical",
      "url": "https://example.com/support-example"
    }
  ]
}
  1. Observe that it also returns 405 Method Not Allowed.

Cloud

AWS

Browser

Chrome

Version

latest

Relevant log output

Failing JSON import request from the modal
- Endpoint: POST /api/data-contracts/odcs/import
- Status: 405
- Request ID: 66487843-c866-4760-bd15-cd8df232a3af
- Response body: {"detail":"Method Not Allowed"}

Equivalent fetch test with minimal JSON contract without support
- Endpoint: POST /api/data-contracts/odcs/import
- Status: 405
- Response body: {"detail":"Method Not Allowed"}

Equivalent fetch test with minimal JSON contract with support
- Endpoint: POST /api/data-contracts/odcs/import
- Status: 405
- Response body: {"detail":"Method Not Allowed"}

Frontend console
Failed to load resource: the server responded with a status of 405 ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions