[Wikidata-bugs] [Maniphest] T315164: Wikibase REST API Swagger docs are missing "type: statement" on statements POST endpoint

2022-09-25 Thread connorshea
connorshea added a comment.


  Thank you!

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: WMDE-leszek, connorshea
Cc: WMDE-leszek, Ollie.Shotton_WMDE, connorshea, Aklapper, Astuthiodit_1, 
karapayneWMDE, Invadibot, maantietaja, ItamarWMDE, Akuckartz, Nandana, Lahi, 
Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
___
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org


[Wikidata-bugs] [Maniphest] T315164: Wikibase REST API Swagger docs are missing "type: statement" on statements POST endpoint

2022-09-22 Thread WMDE-leszek
WMDE-leszek closed this task as "Resolved".
WMDE-leszek claimed this task.

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: WMDE-leszek
Cc: WMDE-leszek, Ollie.Shotton_WMDE, connorshea, Aklapper, Astuthiodit_1, 
karapayneWMDE, Invadibot, maantietaja, ItamarWMDE, Akuckartz, Nandana, Lahi, 
Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
___
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org


[Wikidata-bugs] [Maniphest] T315164: Wikibase REST API Swagger docs are missing "type: statement" on statements POST endpoint

2022-09-22 Thread WMDE-leszek
WMDE-leszek added a comment.


  "type" field has been removed from requests and responses (see T316077 
) which makes the issue resolved I'd 
think.

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: WMDE-leszek
Cc: WMDE-leszek, Ollie.Shotton_WMDE, connorshea, Aklapper, Astuthiodit_1, 
karapayneWMDE, Invadibot, maantietaja, ItamarWMDE, Akuckartz, Nandana, Lahi, 
Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
___
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org


[Wikidata-bugs] [Maniphest] T315164: Wikibase REST API Swagger docs are missing "type: statement" on statements POST endpoint

2022-08-24 Thread Ollie.Shotton_WMDE
Ollie.Shotton_WMDE added a comment.


  Hi, thanks for submitting this task and sorry this wasn't better documented!
  
  We were discussing removing the "type" field altogether which is why the 
Swagger docs and implementation don't quite align. Your ticket prompted us to 
create T316077  to address this.

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Ollie.Shotton_WMDE
Cc: Ollie.Shotton_WMDE, connorshea, Aklapper, Astuthiodit_1, karapayneWMDE, 
Invadibot, maantietaja, ItamarWMDE, Akuckartz, Nandana, Lahi, Gq86, 
GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, 
Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
___
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org


[Wikidata-bugs] [Maniphest] T315164: Wikibase REST API Swagger docs are missing "type: statement" on statements POST endpoint

2022-08-13 Thread connorshea
connorshea added a comment.


  I managed to figure out how to generate the Swagger docs locally, and 
changing `repo/rest-api/specs/global/request-parts.json` in the Wikibase repo 
fixes this problem:
  
{
"StatementRequest": {
"allOf": [
{
"type": "object",
"properties": {
"statement": {
"allOf": [
{ "$ref": 
"./schemas.json#/Statement" },
{ "$ref": 
"#/StatementRequestRequired" }
]
}
},
"required": [ "statement" ]
},
{ "$ref": "./request-parts.json#/MediawikiEdit" }
]
},
"MediawikiEdit": {
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": { "type": "string" },
"default": [ ]
},
"bot": {
"type": "boolean",
"default": false
},
"comment": {
"type": "string"
}
}
},
"QualifiersRequestRequired": {
"additionalProperties": {
"items": {
"required": [ "snaktype", "property" ]
}
}
},
"ReferenceRequestRequired": {
"required": [ "snaks", "snaks-order" ],
"properties": {
"snaks": {
"additionalProperties": {
"items": {
"required": [ "snaktype", 
"property" ]
}
}
}
}
},
"ReferencesRequestRequired": {
"items": { "$ref": "#/ReferenceRequestRequired" }
},
"StatementRequestRequired": {
"required": [ "mainsnak", "type" ],
"properties": {
"mainsnak": { "required": [ "snaktype", "property" ] },
"qualifiers": { "$ref": "#/QualifiersRequestRequired" },
"references": { "$ref": "#/ReferencesRequestRequired" },
"type": {
"type": "string",
"example": "statement"
}
}
}
}
  
  Pretty much just added the `type` property at the bottom and made `type` a 
required property. I'd contribute this myself, but I have no idea how to use 
Gerrit and I assume it'll probably need some changes after code review, so I'll 
let someone more familiar handle things :)

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: connorshea
Cc: connorshea, Aklapper, Astuthiodit_1, karapayneWMDE, Invadibot, maantietaja, 
ItamarWMDE, Akuckartz, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, 
LawExplorer, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, aude, 
Lydia_Pintscher, Mbch331
___
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org


[Wikidata-bugs] [Maniphest] T315164: Wikibase REST API Swagger docs are missing "type: statement" on statements POST endpoint

2022-08-13 Thread connorshea
connorshea created this task.
connorshea added projects: Wikibase REST API, Wikidata.
Restricted Application added a subscriber: Aklapper.

TASK DESCRIPTION
  **Steps to replicate the issue** (include links if applicable):
  
  - View the REST API Swagger docs at 
https://doc.wikimedia.org/Wikibase/master/js/rest-api/
  - See the format defined in the docs for creating a new statement with the 
`POST /entities/items/{item_id}/statements` endpoint.
  - Try to post the first JSON blob below to an item on the beta Wikidata site.
  - See that it errors with `{ "code": "invalid-statement-data", "message": 
"Invalid statement data provided" }`, despite having all the components that 
are declared in the Swagger docs.
  
  This is what I tried POSTing to the endpoint, which failed:
  
{
  "statement": {
"mainsnak": {
  "snaktype": "value",
  "property": "P625",
  "datatype": "string",
  "datavalue": {
"type": "string",
"value": "test data"
  }
}
  },
  "bot": true,
  "tags": [],
  "comment": "foo"
}
  
  This is what the endpoint *actually* wanted:
  
{
  "statement": {
"mainsnak": {
  "snaktype": "value",
  "property": "P625",
  "datatype": "string",
  "datavalue": {
"type": "string",
"value": "test data"
  }
},
"type": "statement"
  },
  "bot": true,
  "tags": [],
  "comment": "foo"
}
  
  The only difference is the `"type": "statement"` line, which the Swagger docs 
do not mention/include. I only figured this out after going into the Wikibase 
codebase and browsing the unit tests. 
  
  **What happens?**:
  
  An error about an invalid statement is returned and the Swagger docs make no 
mention of a `type` attribute in the statement JSON.
  
  **What should have happened instead?**:
  
  The Swagger docs for the statements POST endpoint should include the required 
`type` key.
  
  **Software version** (skip for WMF-hosted wikis like Wikipedia): Beta 
Wikidata site
  
  **Other information** (browser name/version, screenshots, etc.):
  
  If the same `type` attribute should be used on the PUT endpoint(s) for 
statements, those should be updated as well.

TASK DETAIL
  https://phabricator.wikimedia.org/T315164

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: connorshea
Cc: connorshea, Aklapper, Astuthiodit_1, karapayneWMDE, Invadibot, maantietaja, 
ItamarWMDE, Akuckartz, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, 
LawExplorer, _jensen, rosalieper, Scott_WUaS, Wikidata-bugs, aude, 
Lydia_Pintscher, Mbch331
___
Wikidata-bugs mailing list -- wikidata-bugs@lists.wikimedia.org
To unsubscribe send an email to wikidata-bugs-le...@lists.wikimedia.org