{"id":15091471,"url":"https://github.com/ybelenko/openapi-data-mocker-interfaces","last_synced_at":"2026-01-05T05:05:57.810Z","repository":{"id":57086329,"uuid":"254565726","full_name":"ybelenko/openapi-data-mocker-interfaces","owner":"ybelenko","description":"Package with OpenApiDataMocker interfaces.","archived":false,"fork":false,"pushed_at":"2022-03-19T00:15:15.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T14:11:33.180Z","etag":null,"topics":["data","fake","faker","interface","mock","mocker","oas","oas3","openapi","swagger"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ybelenko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-10T06:55:37.000Z","updated_at":"2022-03-19T00:15:19.000Z","dependencies_parsed_at":"2022-08-24T22:50:33.696Z","dependency_job_id":null,"html_url":"https://github.com/ybelenko/openapi-data-mocker-interfaces","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Fopenapi-data-mocker-interfaces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Fopenapi-data-mocker-interfaces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Fopenapi-data-mocker-interfaces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ybelenko%2Fopenapi-data-mocker-interfaces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ybelenko","download_url":"https://codeload.github.com/ybelenko/openapi-data-mocker-interfaces/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244945590,"owners_count":20536296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data","fake","faker","interface","mock","mocker","oas","oas3","openapi","swagger"],"created_at":"2024-09-25T10:41:15.953Z","updated_at":"2026-01-05T05:05:57.781Z","avatar_url":"https://github.com/ybelenko.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenApi Data Mocker Interfaces\n[![Coding Style](https://github.com/ybelenko/openapi-data-mocker-interfaces/actions/workflows/ci.yml/badge.svg)](https://github.com/ybelenko/openapi-data-mocker-interfaces/actions/workflows/ci.yml)\n\nThis repository holds interfaces to generate fake data from OpenAPI Specification(OAS3). Note that this is not an implementation.\n\n## Requirements\nPHP 7.3 or newer. It could work with older versions, but it's not worth to support _EOL(end of life)_ PHP.\n\n__Important notice! While PHP 8.0 declared in `composer.json` this package hasn't been tested against it.__\n\n## Interfaces\n|                                           Class Name                                         | Description |\n|----------------------------------------------------------------------------------------------|-------------|\n| [OpenAPIServer\\Mock\\OpenApiModelInterface](src/Mock/OpenApiModelInterface.php)               | All referenced components must implement that interface. |\n| [OpenAPIServer\\Mock\\OpenApiDataMockerInterface](src/Mock/OpenApiDataMockerInterface.php)     | Basic data generator. Can mock scalar data types. |\n| [OpenAPIServer\\Mock\\OpenApiServerMockerInterface](src/Mock/OpenApiServerMockerInterface.php) | Enhanced data generator. Can mock server request and server response. |\n| [OpenAPIServer\\Mock\\Exceptions\\OpenApiDataMockerException](src/Mock/Exceptions/OpenApiDataMockerException.php) | Implementation should throw exceptions inherited from that class. |\n\n### `OpenAPIServer\\Mock\\OpenApiDataMockerInterface` Constants\n[OpenAPISpecification - Data Types](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#dataTypes)\n\n| Constant Name           | Referenced OAS type | Referenced OAS format |\n|:-----------------------:|:-------------------:|:---------------------:|\n| `DATA_TYPE_INTEGER`     |     `integer`       |                       |\n| `DATA_TYPE_NUMBER`      |     `number`        |                       |\n| `DATA_TYPE_STRING`      |     `string`        |                       |\n| `DATA_TYPE_BOOLEAN`     |     `boolean`       |                       |\n| `DATA_TYPE_ARRAY`       |     `array`         |                       |\n| `DATA_TYPE_OBJECT`      |     `object`        |                       |\n| `DATA_FORMAT_INT32`     |                     |        `int32`        |\n| `DATA_FORMAT_INT64`     |                     |        `int64`        |\n| `DATA_FORMAT_FLOAT`     |                     |        `float`        |\n| `DATA_FORMAT_DOUBLE`    |                     |        `double`       |\n| `DATA_FORMAT_BYTE`      |                     |         `byte`        |\n| `DATA_FORMAT_BINARY`    |                     |        `binary`       |\n| `DATA_FORMAT_DATE`      |                     |         `date`        |\n| `DATA_FORMAT_DATE_TIME` |                     |       `date-time`     |\n| `DATA_FORMAT_PASSWORD`  |                     |       `password`      |\n| `DATA_FORMAT_EMAIL`     |                     |                       |\n| `DATA_FORMAT_UUID`      |                     |                       |\n\n### `OpenAPIServer\\Mock\\OpenApiDataMockerInterface` Methods\n\n|                    Method Name                      |                    Description                  | Return Type |\n|-----------------------------------------------------|-------------------------------------------------|:-----------:|\n| `mockData(string $dataType, ?string $dataFormat = null, ?array $options = [])`| Mocks OpenApi Data.                             |   `mixed`   |\n| `mockInteger(?string $dataFormat = null, ?float $minimum = null, ?float $maximum = null, ?bool $exclusiveMinimum = false, ?bool $exclusiveMaximum = false): int` | Shortcut to mock integer type. Equivalent to `mockData(DATA_TYPE_INTEGER)`\\*. | `int`  |\n| `mockNumber($dataFormat = null, $minimum = null, $maximum = null, $exclusiveMinimum = false, $exclusiveMaximum = false): float` | Shortcut to mock number type. Equivalent to `mockData(DATA_TYPE_NUMBER)`\\*. | `float` |\n| `mockString(?string $dataFormat = null, ?int $minLength = 0, ?int $maxLength = null, ?array $enum = null, ?string $pattern = null): string` | Shortcut to mock string type. Equivalent to `mockData(DATA_TYPE_STRING)`\\*. | `string` |\n| `mockBoolean(): bool` | Shortcut to mock boolean type. Equivalent to `mockData(DATA_TYPE_BOOLEAN)`\\* | `bool` |\n| `mockArray(array $items, ?int $minItems = 0, ?int $maxItems = null, ?bool $uniqueItems = false): array` | Shortcut to mock array type. `Equivalent to mockData(DATA_TYPE_ARRAY)`\\*. | `array` |\n| `mockObject(array $properties, ?int $minProperties = 0, ?int $maxProperties = null, $additionalProperties = null, ?array $required = null): object` | Shortcut to mock object type. Equivalent to `mockData(DATA_TYPE_OBJECT)`\\*. | `object` |\n| `mockSchemaObject(array $schema)` | Mocks OpenApi Schema Object. | `mixed` |\n\n\\* constant class is omitted, so `mockData(DATA_TYPE_INTEGER)` means `mockData(\\OpenAPIServer\\Mock\\OpenApiDataMockerInterface\\DATA_TYPE_INTEGER)`.\n\n### `OpenAPIServer\\Mock\\OpenApiModelInterface` Methods\n|                    Method Name                      |                                       Description                                    | Return Type |\n|-----------------------------------------------------|--------------------------------------------------------------------------------------|:-----------:|\n| static `getOpenApiSchema(): array`                         | Gets OAS 3.0 schema mapped to current class.                                         |   `array`   |\n| static `createFromData($data): OpenApiModelInterface`                      | Creates new instance from provided data.                                             |   `OpenAPIServer\\Mock\\OpenApiModelInterface`   |\n| `jsonSerialize()` inherited from `JsonSerializable` | Serializes the object to a value that can be serialized natively by `json_encode()`. |   `mixed`   |\n\n### `OpenAPIServer\\Mock\\OpenApiServerMockerInterface` Methods\nSame methods as `OpenAPIServer\\Mock\\OpenApiDataMockerInterface` + following methods:\n\n|           Method Name           |         Description          |               Return Type                 |\n|---------------------------------|------------------------------|:-----------------------------------------:|\n| `setServer(?string $url = null, ?array $variables = null): void`   | Sets base url for mocked requests.  | `void` |\n| `mockRequest(string $path, string $method, ?array $parameters = null, ?array $requestBody = null, ?array $security = null, ?array $callbacks = null): ServerRequestInterface`   | Mocks PSR-7 server request.  | `Psr\\Http\\Message\\ServerRequestInterface` |\n| `mockResponse(string $httpStatusCode = '200', ?array $headers = null, ?string $contentMediaType = null, ?array $contentSchema = null): ResponseInterface` | Mocks PSR-7 server response. | `Psr\\Http\\Message\\ResponseInterface`      |\n\n### `OpenAPIServer\\Mock\\Exceptions\\OpenApiDataMockerException`\nThis class makes possible to catch exceptions related to mocking feature only. It's highly encouraged not to throw builtin PHP exceptions like `Exception`, `InvalidArgumentException` etc. Use this class or extend it with your own exceptions to fit your needs.\n\n## Related Packages\n* [Openapi Data Mocker](https://github.com/ybelenko/openapi-data-mocker) - first implementation of OAS3 fake data generator.\n* [Openapi Data Mocker Server Middleware](https://github.com/ybelenko/openapi-data-mocker-server-middleware) - PSR-15 HTTP server middleware.\n\n## Copyright\nWhile author of this package is top contributor to OpenAPI-Generator project he's not member of OpenAPI Initiative (OAI).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fybelenko%2Fopenapi-data-mocker-interfaces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fybelenko%2Fopenapi-data-mocker-interfaces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fybelenko%2Fopenapi-data-mocker-interfaces/lists"}