Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
shouldIncludeReferenceOnly example
ksort
(
$definitions
)
;
foreach
(
$definitions
as
$definition
)
{
if
(
!
$definition
instanceof EntityDefinition
)
{
continue
;
}
if
(
!
$this
->
shouldDefinitionBeIncluded
(
$definition
)
)
{
continue
;
}
$onlyReference
=
$this
->
shouldIncludeReferenceOnly
(
$definition
,
$forSalesChannel
)
;
$schema
=
$this
->definitionSchemaBuilder->
getSchemaByDefinition
(
$definition
,
$this
->
getResourceUri
(
$definition
)
,
$forSalesChannel
,
$onlyReference
)
;
$openApi
->components->
merge
(
$schema
)
;
}
$this
->
addGeneralInformation
(
$openApi
)
;
$this
->
addContentTypeParameter
(
$openApi
)
;
$data
=
json_decode
(
$openApi
->
toJson
(
)
, true, 512, \JSON_THROW_ON_ERROR
)
;
$data
[
'paths'
]
??=
[
]
;
$this
->openApiBuilder->
enrich
(
$openApi
,
$api
)
;
ksort
(
$definitions
)
;
foreach
(
$definitions
as
$definition
)
{
if
(
!
$this
->
shouldDefinitionBeIncluded
(
$definition
)
)
{
continue
;
}
$onlyFlat
=
match
(
$apiType
)
{
DefinitionService::TYPE_JSON => true,
default
=>
$this
->
shouldIncludeReferenceOnly
(
$definition
,
$forSalesChannel
)
,
}
;
$schema
=
$this
->definitionSchemaBuilder->
getSchemaByDefinition
(
$definition
,
$this
->
getResourceUri
(
$definition
)
,
$forSalesChannel
,
$onlyFlat
,
$apiType
)
;
$openApi
->components->
merge
(
$schema
)
;