API: changed date-format, camelCase instead of snake_case, null values, update and create for customer and project (#718)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
jms_serializer:
|
||||
visitors:
|
||||
json:
|
||||
json_serialization:
|
||||
options:
|
||||
- JSON_PRETTY_PRINT
|
||||
- JSON_UNESCAPED_SLASHES
|
||||
|
||||
@@ -29,10 +29,10 @@ fos_rest:
|
||||
# view_handler: fos_rest.view_handler.default
|
||||
# inflector: fos_rest.inflector.doctrine
|
||||
# validator: validator
|
||||
# serializer:
|
||||
serializer:
|
||||
# version: null
|
||||
# groups: []
|
||||
# serialize_null: false
|
||||
serialize_null: true
|
||||
view:
|
||||
default_engine: twig
|
||||
# force_redirects:
|
||||
@@ -75,7 +75,7 @@ fos_rest:
|
||||
# decoders:
|
||||
# name: ~
|
||||
array_normalizer:
|
||||
service: null
|
||||
service: fos_rest.normalizer.camel_keys
|
||||
forms: true
|
||||
format_listener:
|
||||
enabled: true
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
jms_serializer:
|
||||
handlers:
|
||||
datetime:
|
||||
default_format: 'Y-m-d\TH:i:sO' # DATE_ISO8601
|
||||
visitors:
|
||||
xml:
|
||||
xml_serialization:
|
||||
format_output: '%kernel.debug%'
|
||||
metadata:
|
||||
directories:
|
||||
@@ -10,3 +13,5 @@ jms_serializer:
|
||||
App:
|
||||
namespace_prefix: "App"
|
||||
path: "%kernel.root_dir%/../config/serializer/App"
|
||||
property_naming:
|
||||
id: 'jms_serializer.identical_property_naming_strategy'
|
||||
|
||||
@@ -2,13 +2,20 @@ nelmio_api_doc:
|
||||
models:
|
||||
use_jms: true
|
||||
names:
|
||||
- { alias: CustomerEditForm, type: App\Form\CustomerEditForm, groups: [Default, Entity, Customer] }
|
||||
- { alias: CustomerEntity, type: App\Entity\Customer, groups: [Default, Entity, Customer] }
|
||||
- { alias: CustomerCollection, type: App\Entity\Customer, groups: [Default, Collection, Customer] }
|
||||
- { alias: ProjectEditForm, type: App\Form\ProjectEditForm, groups: [Default, Entity, Project] }
|
||||
- { alias: ProjectEntity, type: App\Entity\Project, groups: [Default, Entity, Project] }
|
||||
- { alias: ActivityEntity, type: App\Entity\Activity, groups: [Default, Entity, Activity] }
|
||||
- { alias: ProjectCollection, type: App\Entity\Project, groups: [Default, Collection, Project] }
|
||||
- { alias: ActivityEditForm, type: App\Form\ActivityEditForm, groups: [Default, Entity, Activity] }
|
||||
- { alias: ActivityEntity, type: App\Entity\Activity, groups: [Default, Entity, Activity] }
|
||||
- { alias: ActivityCollection, type: App\Entity\Activity, groups: [Default, Collection, Activity] }
|
||||
- { alias: TimesheetEditForm, type: App\Form\TimesheetEditForm, groups: [Default, Entity, Timesheet] }
|
||||
- { alias: TimesheetEntity, type: App\Entity\Timesheet, groups: [Default, Entity, Timesheet] }
|
||||
- { alias: TimesheetCollection, type: App\Entity\Timesheet, groups: [Default, Collection, Timesheet] }
|
||||
- { alias: UserEntity, type: App\Entity\User, groups: [Default, Entity, User] }
|
||||
- { alias: UserCollection, type: App\Entity\User, groups: [Default, Collection, User] }
|
||||
- { alias: I18nConfig, type: App\API\Model\I18n, groups: [Default] }
|
||||
areas:
|
||||
path_patterns:
|
||||
@@ -18,8 +25,11 @@ nelmio_api_doc:
|
||||
schemes: [http, https]
|
||||
info:
|
||||
title: Kimai 2 - API Docs
|
||||
description: REST API for the Kimai 2 time-tracking software. It's rather limited by now. If you need other methods, please let me know at GitHub!
|
||||
version: 0.2
|
||||
description: |
|
||||
REST API for the Kimai 2 time-tracking software. It is not yet considered stable and BC breaks might happen, even though I try to avoid them as much as possible.
|
||||
- Collections return less data than explicit entity calls
|
||||
- DateTime formats are explained in detail at https://www.kimai.org/documentation/rest-api.html
|
||||
version: 0.3
|
||||
# parameters:
|
||||
# hostname:
|
||||
# name: hostname
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
jms_serializer:
|
||||
visitors:
|
||||
json:
|
||||
json_serialization:
|
||||
options:
|
||||
- JSON_UNESCAPED_SLASHES
|
||||
- JSON_PRESERVE_ZERO_FRACTION
|
||||
|
||||
25
config/serializer/App/API.Model.Version.yml
Normal file
25
config/serializer/App/API.Model.Version.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
App\API\Model\Version:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [version, candidate, semver, name, copyright]
|
||||
properties:
|
||||
version:
|
||||
include: true
|
||||
type: string
|
||||
example: 0.9
|
||||
groups: [Default]
|
||||
candidate:
|
||||
include: true
|
||||
type: string
|
||||
groups: [Default]
|
||||
semver:
|
||||
include: true
|
||||
type: string
|
||||
groups: [Default]
|
||||
name:
|
||||
include: true
|
||||
type: string
|
||||
groups: [Default]
|
||||
copyright:
|
||||
include: true
|
||||
type: string
|
||||
groups: [Default]
|
||||
@@ -22,10 +22,10 @@ App\Entity\Project:
|
||||
groups: [Entity]
|
||||
fixedRate:
|
||||
include: true
|
||||
groups: [Entity]
|
||||
groups: [Default]
|
||||
hourlyRate:
|
||||
include: true
|
||||
groups: [Entity]
|
||||
groups: [Default]
|
||||
customer:
|
||||
include: false
|
||||
exclude: true
|
||||
|
||||
@@ -6,11 +6,9 @@ App\Entity\Timesheet:
|
||||
include: true
|
||||
groups: [Default]
|
||||
begin:
|
||||
include: true
|
||||
groups: [Default]
|
||||
exclude: true
|
||||
end:
|
||||
include: true
|
||||
groups: [Default]
|
||||
exclude: true
|
||||
duration:
|
||||
include: true
|
||||
groups: [Default]
|
||||
@@ -30,18 +28,22 @@ App\Entity\Timesheet:
|
||||
include: true
|
||||
groups: [Entity]
|
||||
activity:
|
||||
include: false
|
||||
exclude: true
|
||||
groups: [Default]
|
||||
project:
|
||||
include: false
|
||||
exclude: true
|
||||
groups: [Default]
|
||||
user:
|
||||
include: false
|
||||
exclude: true
|
||||
groups: [Default]
|
||||
virtual_properties:
|
||||
getBegin:
|
||||
serialized_name: begin
|
||||
exp: "object.getBegin() === null ? null : object.getBegin()"
|
||||
type: DateTime
|
||||
groups: [Default]
|
||||
getEnd:
|
||||
serialized_name: end
|
||||
exp: "object.getEnd() === null ? null : object.getEnd()"
|
||||
type: DateTime
|
||||
groups: [Default]
|
||||
getActivity:
|
||||
serialized_name: activity
|
||||
exp: "object.getActivity() === null ? null : object.getActivity().getId()"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
App\Entity\User:
|
||||
exclusion_policy: All
|
||||
custom_accessor_order: [id, alias, title, avatar, language, timezone]
|
||||
properties:
|
||||
id:
|
||||
include: true
|
||||
@@ -13,3 +14,14 @@ App\Entity\User:
|
||||
avatar:
|
||||
include: true
|
||||
groups: [Entity]
|
||||
virtual_properties:
|
||||
getLanguage:
|
||||
serialized_name: language
|
||||
exp: "object.getPreferenceValue('language') === null ? null : object.getPreferenceValue('language')"
|
||||
type: string
|
||||
groups: [Entity]
|
||||
getTimezone:
|
||||
serialized_name: timezone
|
||||
exp: "object.getPreferenceValue('timezone') === null ? null : object.getPreferenceValue('timezone')"
|
||||
type: string
|
||||
groups: [Entity]
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
FOS\UserBundle\Model\User:
|
||||
exclusion_policy: NONE
|
||||
exclusion_policy: All
|
||||
properties:
|
||||
username:
|
||||
include: true
|
||||
groups: [Default]
|
||||
enabled:
|
||||
include: true
|
||||
groups: [Default]
|
||||
groups:
|
||||
include: true
|
||||
groups: [Entity]
|
||||
roles:
|
||||
type: array<string>
|
||||
include: true
|
||||
groups: [Entity]
|
||||
groups:
|
||||
exclude: true
|
||||
email:
|
||||
exclude: true
|
||||
emailCanonical:
|
||||
|
||||
Reference in New Issue
Block a user