OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#40945] add meaningful examples to the form endpoints
Eric Schuberta28f9cc987b9
diff --git a/docs/api/apiv3/components/examples/work_package_create_only_subject.yml b/docs/api/apiv3/components/examples/work_package_create_only_subject.ymlnew file mode 100644index 00000000000..39f3795735f--- /dev/null+++ b/docs/api/apiv3/components/examples/work_package_create_only_subject.yml@@ -0,0 +1,5 @@+description: |-+ A request body to create a work package with only a subject. This can only be used, if the project context is already+ given in the path. All other values will fall back to defaults.+value:+ subject: Replace GNK power droidsdiff --git a/docs/api/apiv3/components/examples/work_package_create_valid.yml b/docs/api/apiv3/components/examples/work_package_create_valid.ymlnew file mode 100644index 00000000000..0e251cf1853--- /dev/null+++ b/docs/api/apiv3/components/examples/work_package_create_valid.yml@@ -0,0 +1,20 @@+description: |-+ A valid request body to create or edit a work package with a couple of properties.+value:+ subject: Install Dromund Kass planetary shield+ description:+ format: markdown+ raw: |-+ # TODO++ The planetary shield of Dromund Kass needs to be installed to protect the planet from orbital bombardment.+ startDate: '2877-07-21'+ duration: P1337D+ estimatedTime: P1Y5DT13H+ ignoreNonWorkingDays: true+ project:+ href: /api/v3/projects/42+ type:+ href: /api/v3/types/13+ status:+ href: /api/v3/statuses/2diff --git a/docs/api/apiv3/components/examples/work_package_edit_subject.yml b/docs/api/apiv3/components/examples/work_package_edit_subject.ymlnew file mode 100644index 00000000000..ec3c65b384e--- /dev/null+++ b/docs/api/apiv3/components/examples/work_package_edit_subject.yml@@ -0,0 +1,4 @@+description: |-+ A request body to edit a work package's subject.+value:+ subject: Replace GNK power droidsdiff --git a/docs/api/apiv3/components/schemas/work_package_form_model.yml b/docs/api/apiv3/components/schemas/work_package_form_model.ymlindex 16b7bfb11ce..e9c957f26e6 100644--- a/docs/api/apiv3/components/schemas/work_package_form_model.yml+++ b/docs/api/apiv3/components/schemas/work_package_form_model.yml@@ -17,11 +17,10 @@ properties:schema:$ref: './work_package_schema_model.yml'validationErrors:- type: array- items:- type: object+ type: objectdescription: |-- A list of validation errors. This list is empty, if the request body is valid.+ All validation errors, where the key is the faulty property. The object is empty, if the request body is+ valid._links:type: objectproperties:diff --git a/docs/api/apiv3/components/schemas/work_package_write_model.yml b/docs/api/apiv3/components/schemas/work_package_write_model.ymlindex 990dbb4ff9d..f0893ae3ff4 100644--- a/docs/api/apiv3/components/schemas/work_package_write_model.yml+++ b/docs/api/apiv3/components/schemas/work_package_write_model.yml@@ -1,6 +1,9 @@# Schema: WorkPackageWriteModel---type: object+description: |-+ This model is used for creating and updating work packages. It can also be used for validation against the work+ package form endpoints.properties:subject:type: stringdiff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.ymlindex e558237e6b9..c9ffc28257e 100644--- a/docs/api/apiv3/openapi-spec.yml+++ b/docs/api/apiv3/openapi-spec.yml@@ -567,6 +567,12 @@ components:$ref: "./components/examples/view_work_packages_table.yml"ViewTeamPlanner:$ref: "./components/examples/view_team_planner.yml"+ WorkPackageCreateOnlySubject:+ $ref: "./components/examples/work_package_create_only_subject.yml"+ WorkPackageCreateValid:+ $ref: "./components/examples/work_package_create_valid.yml"+ WorkPackageEditSubject:+ $ref: "./components/examples/work_package_edit_subject.yml"responses:InvalidQuery:diff --git a/docs/api/apiv3/paths/project_work_packages_form.yml b/docs/api/apiv3/paths/project_work_packages_form.ymlindex 86321426ba9..382d3662408 100644--- a/docs/api/apiv3/paths/project_work_packages_form.yml+++ b/docs/api/apiv3/paths/project_work_packages_form.yml@@ -1,8 +1,8 @@# /api/v3/projects/{id}/work_packages/form---post:- summary: Work Package Create Form For Project- operationId: Work_Package_Create_Form_For_Project+ summary: Form for creating Work Packages in a Project+ operationId: form_create_work_package_in_projecttags:- Work Packagesdescription: |-@@ -22,6 +22,11 @@ post:application/json:schema:$ref: '../components/schemas/work_package_write_model.yml'+ examples:+ 'Minimal example':+ $ref: '../components/examples/work_package_create_only_subject.yml'+ 'Valid example':+ $ref: '../components/examples/work_package_create_valid.yml'responses:'200':description: OKdiff --git a/docs/api/apiv3/paths/work_package_form.yml b/docs/api/apiv3/paths/work_package_form.ymlindex 0e0d6fad299..64870d121d5 100644--- a/docs/api/apiv3/paths/work_package_form.yml+++ b/docs/api/apiv3/paths/work_package_form.yml@@ -1,16 +1,16 @@# /api/v3/work_packages/{id}/form---post:- summary: Work Package Edit Form- operationId: Work_Package_Edit_Form+ summary: Form for editing a Work Package+ operationId: form_edit_work_packagetags:- Work Packagesdescription: |-When calling this endpoint, the client provides a single object containing the properties and links to be- created, in the body. The input is validated and a schema response is returned. If the validation errors of the- response is empty, the same payload can be used to create a work package.+ edited, in the body. The input is validated and a schema response is returned. If the validation errors of the+ response is empty, the same payload can be used to edit the work package.- Only the properties of the work package write model are allowed to set on a work package on creation.+ Only the properties of the work package write model are allowed to set on a work package on editing.When setting start date, finish date, and duration together, their correctness will be checked and a validationerror will be returned if one value does not match with the two others. You can make the server compute a value:@@ -22,6 +22,9 @@ post:application/json:schema:$ref: '../components/schemas/work_package_write_model.yml'+ examples:+ 'Changing subject':+ $ref: '../components/examples/work_package_edit_subject.yml'parameters:- name: iddescription: ID of the work package being modifieddiff --git a/docs/api/apiv3/paths/work_packages_form.yml b/docs/api/apiv3/paths/work_packages_form.ymlindex a9c2d354195..4998b9a4181 100644--- a/docs/api/apiv3/paths/work_packages_form.yml+++ b/docs/api/apiv3/paths/work_packages_form.yml@@ -1,12 +1,36 @@# /api/v3/work_packages/form---post:+ summary: Form for creating a Work Package+ operationId: form_create_work_package+ tags:+ - Work Packages+ description: |-+ When calling this endpoint, the client provides a single object containing the properties and links to be+ created, in the body. The input is validated and a schema response is returned. If the validation errors of the+ response is empty, the same payload can be used to create a work package.++ Only the properties of the work package write model are allowed to set on a work package on creation.++ When setting start date, finish date, and duration together, their correctness will be checked and a validation+ error will be returned if one value does not match with the two others. You can make the server compute a value:+ set only two values in the request and the third one will be computed and returned in the response. For instance,+ when sending `{ "startDate": "2022-08-23", duration: "P2D" }`, the response will+ include `{ "dueDate": "2022-08-24" }`.+ requestBody:+ content:+ application/json:+ schema:+ $ref: '../components/schemas/work_package_write_model.yml'+ examples:+ 'Valid creation':+ $ref: '../components/examples/work_package_create_valid.yml'responses:'200':description: OK- headers: {}- tags:- - Work Packages- description: ''- operationId: Work_Package_Create_Form- summary: Work Package Create Form+ content:+ application/json:+ schema:+ $ref: '../components/schemas/work_package_form_model.yml'+ '415':+ $ref: '../components/responses/unsupported_media_type.yml'