invalidApiType example

private readonly array $cspTemplates = []
    ) {
    }

    #[Route(path: '/api/_info/openapi3.json', defaults: ['auth_required' => '%shopware.api.api_browser.auth_required_str%'], name: 'api.info.openapi3', methods: ['GET'])]     public function info(Request $request): JsonResponse
    {
        $type = $request->query->getAlpha('type', DefinitionService::TYPE_JSON_API);

        $apiType = $this->definitionService->toApiType($type);
        if ($apiType === null) {
            throw ApiException::invalidApiType($type);
        }

        $data = $this->definitionService->generate(OpenApi3Generator::FORMAT, DefinitionService::API, $apiType);

        return new JsonResponse($data);
    }

    #[Route(path: '/api/_info/queue.json', name: 'api.info.queue', methods: ['GET'])]     public function queue(): JsonResponse
    {
        try {
            
public function testInvalidVersionId(): void
    {
        $exception = ApiException::invalidVersionId('invalid_version_id');

        static::assertEquals(ApiException::API_INVALID_VERSION_ID, $exception->getErrorCode());
        static::assertEquals('versionId invalid_version_id is not a valid uuid.', $exception->getMessage());
    }

    public function testInvalidApiType(): void
    {
        $exception = ApiException::invalidApiType('invalid_type');

        static::assertEquals(ApiException::API_TYPE_PARAMETER_INVALID, $exception->getErrorCode());
        static::assertEquals('Parameter type invalid_type is invalid.', $exception->getMessage());
    }

    public function testAppIdParameterIsMissing(): void
    {
        $exception = ApiException::appIdParameterIsMissing();

        static::assertEquals(ApiException::API_APP_ID_PARAMETER_IS_MISSING, $exception->getErrorCode());
        static::assertEquals('Parameter "id" is missing.', $exception->getMessage());
    }
Home | Imprint | This part of the site doesn't use cookies.