Verified Commit df0309b9 authored by Cyril Vazquez's avatar Cyril Vazquez
Browse files

WIP

parent 4d26e28a
Pipeline #8612 failed with stages
......@@ -22,7 +22,7 @@ use Maarch\Container\Container;
// The configuration is included from a directory contents
// This path MUST be set by an external configuration (ini, constant...)
$containerConfDir = 'V3/App/conf/container';
$containerConfDir = 'V3/App/conf';
$containerConf = [];
foreach (scandir($containerConfDir) as $containerConfFile) {
if (is_file($containerConfDir.DIRECTORY_SEPARATOR.$containerConfFile)) {
......
......@@ -42,7 +42,7 @@ $ressourceCollectionTemplate = new JsonApi\ResourceCollection();
// The configuration is included from a directory contents
// This path MUST be set by an external configuration (ini, constant...)
$schemaConfDir = 'V3/App/conf/httpSchema';
$schemaConfDir = __DIR__.'/schema';
$schemaConf = [];
foreach (scandir($schemaConfDir) as $schemaConfFile) {
if (is_file($schemaConfDir.DIRECTORY_SEPARATOR.$schemaConfFile)) {
......
<?php
$archiveUnitResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('archiveUnit'))
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'identifier',
$propertyTemplate
->withName('identifier')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'displayName',
$propertyTemplate
->withName('displayName')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'date',
$propertyTemplate
->withName('date')
->withType($typeTemplate->withType('string')->withFormat('datetime'))
)
->withProperty(
'type',
$propertyTemplate
->withName('type')
->withType($typeTemplate->withType('string')->withEnum(['item', 'file']))
)
->withProperty(
'profile',
$propertyTemplate
->withName('profile')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'originatingOrg',
$propertyTemplate
->withName('originatingOrg')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'originatingOrgUnit',
$propertyTemplate
->withName('originatingOrgUnit')
->withType($typeTemplate->withType('string'))
)
)
)
->withProperty(
'relationships',
$relationshipsPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'description',
$propertyTemplate
->withName('description')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitDescriptionOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
)
->withProperty(
'management',
$propertyTemplate
->withName('management')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitManagementOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
)
->withProperty(
'parent',
$propertyTemplate
->withName('parent')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitParentOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
)
->withProperty(
'children',
$propertyTemplate
->withName('children')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitChildrenOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
)
->withProperty(
'dataObjects',
$propertyTemplate
->withName('dataObjects')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitDataObjectsOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
)
)
)->withProperty(
'metadata',
$metadataPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'created',
$propertyTemplate
->withName('created')
->withType($typeTemplate->withType('string')->withFormat('datetime'))
)
->withProperty(
'modified',
$propertyTemplate
->withName('modified')
->withType($typeTemplate->withType('string')->withFormat('datetime'))
)
)
);
$archiveUnitDescriptionResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('archiveUnitDescription'))
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitDescriptionOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withAdditionnalProperties(true)
)
);
$archiveUnitManagementResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('archiveUnitManagement'))
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitManagementOperation')
->withParameters([$paramTemplate->withName('archiveUnitId')->withBinding('$resource.id')])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'appraisalRule',
$propertyTemplate
->withName('appraisalRule')
->withType($typeTemplate->withType('object'))
)
->withProperty(
'accessRule',
$propertyTemplate
->withName('accessRule')
->withType($typeTemplate->withType('object'))
)
)
);
$dataObjectResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('dataObject'))
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitDataObjectOperation')
->withParameters([
$paramTemplate->withName('archiveUnitId')->withBinding('$request.path.archiveUnitId'),
$paramTemplate->withName('dataObjectId')->withBinding('$resource.id')
])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'displayName',
$propertyTemplate
->withName('displayName')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'size',
$propertyTemplate
->withName('size')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'fixity',
$propertyTemplate
->withName('fixity')
->withType($typeTemplate->withType('object'))
)
->withProperty(
'format',
$propertyTemplate
->withName('format')
->withType($typeTemplate->withType('string'))
)
)
)
->withProperty(
'relationships',
$relationshipsPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'contents',
$propertyTemplate
->withName('contents')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitDataObjectContentsOperation')
->withParameters([
$paramTemplate->withName('archiveUnitId')->withBinding('$request.path.archiveUnitId'),
$paramTemplate->withName('dataObjectId')->withBinding('$resource.id')
])
)
)
)
)->withProperty(
'metadata',
$metadataPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'created',
$propertyTemplate
->withName('created')
->withType($typeTemplate->withType('string')->withFormat('datetime'))
)
->withProperty(
'modified',
$propertyTemplate
->withName('modified')
->withType($typeTemplate->withType('string')->withFormat('datetime'))
)
)
);
return [
'archiveUnits' => $ressourceCollectionTemplate
->withItems($archiveUnitResourceType)
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitsOperation')
)
,
'archiveUnit' => $archiveUnitResourceType,
'archiveUnitDescription' => $archiveUnitDescriptionResourceType,
'archiveUnitManagement' => $archiveUnitManagementResourceType,
'dataObjects' => $ressourceCollectionTemplate
->withItems($dataObjectResourceType)
->withLink(
'self',
$linkTemplate
->withOperationId('getDataObjectsOperation')
)
,
'dataObject' => $dataObjectResourceType,
];
<?php
$archiveUnitProfileResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('archiveUnitProfile'))
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitProfileOperation')
->withParameters([$paramTemplate->withName('archiveUnitProfileId')->withBinding('$resource.id')])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'identifier',
$propertyTemplate
->withName('identifier')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'displayName',
$propertyTemplate
->withName('displayName')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'description',
$propertyTemplate
->withName('description')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'type',
$propertyTemplate
->withName('type')
->withType($typeTemplate->withType('string')->withEnum(['item', 'file']))
)
->withProperty(
'description',
$propertyTemplate
->withName('profile')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'managementRules',
$propertyTemplate
->withName('managementRules')
->withType($typeTemplate->withType('object'))
)
)
)
->withProperty(
'relationships',
$relationshipsPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'descriptionProfile',
$propertyTemplate
->withName('descriptionProfile')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitDescriptionProfileOperation')
->withParameters([$paramTemplate->withName('archiveUnitProfileId')->withBinding('$resource.id')])
)
)
->withProperty(
'filePlanProfile',
$propertyTemplate
->withName('filePlanProfile')
->withLink(
'related',
$linkTemplate
->withOperationId('getArchiveUnitFilePlanProfileOperation')
->withParameters([$paramTemplate->withName('archiveUnitProfileId')->withBinding('$resource.id')])
)
)
)
);
return [
'archiveUnitProfiles' => $ressourceCollectionTemplate
->withItems($archiveUnitProfileResourceType)
->withLink(
'self',
$linkTemplate
->withOperationId('getArchiveUnitProfilesOperation')
)
,
'archiveUnitProfile' => $archiveUnitProfileResourceType,
];
<?php
$folderResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('folder'))
->withLink(
'self',
$linkTemplate
->withOperationId('getFolderOperation')
->withParameters([$paramTemplate->withName('folderId')->withBinding('$resource.id')])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'name',
$propertyTemplate
->withName('name')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'description',
$propertyTemplate
->withName('description')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'orgUnit',
$propertyTemplate
->withName('orgUnit')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'status',
$propertyTemplate
->withName('status')
->withType($typeTemplate->withType('string'))
)
)
)
->withProperty(
'relationships',
$relationshipsPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'parent',
$propertyTemplate
->withName('parent')
->withLink(
'related',
$linkTemplate
->withOperationId('getFolderParentOperation')
->withParameters([$paramTemplate->withName('folderId')->withBinding('$resource.id')])
)
)
->withProperty(
'children',
$propertyTemplate
->withName('children')
->withLink(
'related',
$linkTemplate
->withOperationId('getFolderChildrenOperation')
->withParameters([$paramTemplate->withName('folderId')->withBinding('$resource.id')])
)
)
->withProperty(
'archiveUnits',
$propertyTemplate
->withName('folderUnits')
->withLink(
'related',
$linkTemplate
->withOperationId('getFolderArchiveUnitsOperation')
->withParameters([$paramTemplate->withName('folderId')->withBinding('$resource.id')])
)
)
)
);
return [
'folders' => $ressourceCollectionTemplate
->withItems($folderResourceType)
->withLink(
'self',
$linkTemplate
->withOperationId('getFoldersOperation')
)
,
'folder' => $folderResourceType,
];
<?php
$orgResourceType = $resourceTemplate
->withDocumentation($docTemplate->withSummary('org'))
->withLink(
'self',
$linkTemplate
->withOperationId('getOrgOperation')
->withParameters([$paramTemplate->withName('orgId')->withBinding('$resource.id')])
)
->withProperty(
'attributes',
$attributesPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'identifier',
$propertyTemplate
->withName('identifier')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'displayName',
$propertyTemplate
->withName('displayName')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'name',
$propertyTemplate
->withName('name')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'description',
$propertyTemplate
->withName('description')
->withType($typeTemplate->withType('string'))
)
->withProperty(
'status',
$propertyTemplate
->withName('status')
->withType($typeTemplate->withType('string'))
)
)
)
->withProperty(
'relationships',
$relationshipsPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'parent',
$propertyTemplate
->withName('parent')
->withType('org')
->withLink(
'related',
$linkTemplate
->withOperationId('getOrgParentOperation')
->withParameters([$paramTemplate->withName('orgId')->withBinding('$resource.id')])
)
)
->withProperty(
'children',
$propertyTemplate
->withName('children')
->withType('orgs')
->withLink(
'related',
$linkTemplate
->withOperationId('getOrgChildrenOperation')
->withParameters([$paramTemplate->withName('orgId')->withBinding('$resource.id')])
)
)
->withProperty(
'orgUnits',
$propertyTemplate
->withName('orgUnits')
->withType('orgUnits')
->withLink(
'related',
$linkTemplate
->withOperationId('getOrgOrgUnitsOperation')
->withParameters([$paramTemplate->withName('orgId')->withBinding('$resource.id')])
)
)
)
);
$orgUnitResourceType = $orgResourceType
->withDocumentation($docTemplate->withSummary('orgUnit'))
->withLink(
'self',
$linkTemplate
->withOperationId('getOrgUnitOperation')
->withParameters([$paramTemplate->withName('orgUnitId')->withBinding('$resource.id')])
)
->withProperty(
'relationships',
$relationshipsPropertyTemplate
->withType(
$objectTemplate
->withProperty(
'parent',
$propertyTemplate
->withName('parent')