Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #6334 - Add JSONSchema definitions for configuration YAML files #6335

Open
wants to merge 1 commit into
base: 4.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
231 changes: 231 additions & 0 deletions schema/codeception.schema.yml
@@ -0,0 +1,231 @@
$id: 'https://codeception.com/1/codeception.schema.yml'
$schema: 'https://json-schema.org/draft/2020-12/schema'
title: 'codeception.dist.yml'
description: 'Schema definition for Codeception main configuration YAML file.'

definitions:
actor_suffix:
type: string
default: 'Tester'

namespace:
type: string
default: ''

include:
type: array
default: []

paths:
type: object
additionalProperties:
type: string
properties:
test:
type: string
log:
type: string
data:
type: string
support:
type: string

extends:
# @todo
oneOf:
-
type: 'null'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that it doesn't make sense to set optional parameters to null in yaml file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Null is the default value in the PHP code, it isn't necessary to set settings to null in yaml file and it can be forbidden.
A more usual approach to omit unnecessary settings.

-
type: string

suite:
type: object
additionalProperties: true
properties:
path:
type: string

suites:
type: object
additionalProperties:
'$ref': '#/definitions/suite'

modules:
type: object
additionalProperties: true
properties:
config:
type: object
additionalProperties: true

extensions:
type: object
additionalProperties: true
properties:
enabled:
type: array
items:
type: string
config:
type: object
additionalProperties: true
commands:
type: object
additionalProperties: true

reporters:
type: object
description: |
https://codeception.com/docs/08-Customization#custom-reporters
additionalProperties:
type: string
examples:
-
xml: Codeception\PHPUnit\Log\JUnit
html: Codeception\PHPUnit\ResultPrinter\HTML
report: Codeception\PHPUnit\ResultPrinter\Report
tap: PHPUnit\Util\Log\TAP
json: PHPUnit\Util\Log\JSON
phpunit-xml: Codeception\PHPUnit\Log\PhpUnit

groups:
# @todo
type: array
default: []

bootstrap:
oneOf:
-
type: 'null'
-
type: 'string'

settings:
type: object
additionalProperties: true
properties:
colors:
type: boolean
default: true
bootstrap:
deprecationMessage: 'Use #/bootstrap instead.'
oneOf:
-
type: 'null'
-
type: 'string'
strict_xml:
type: boolean
default: false
lint:
type: boolean
default: true
backup_globals:
type: boolean
default: true
log_incomplete_skipped:
type: boolean
default: false
report_useless_tests:
type: boolean
default: false
disallow_test_output:
type: boolean
default: false
be_strict_about_changes_to_global_state:
type: boolean
default: false
shuffle:
type: boolean
default: false
suite_class:
type: string
memory_limit:
type: string
log:
type: boolean

coverage:
type: object
additionalProperties: true
properties:
enabled:
type: boolean
show_uncovered:
type: boolean
low_limit:
type: integer
minimum: 0
maximum: 100
high_limit:
type: integer
minimum: 0
maximum: 100
include:
'$ref': '#/definitions/path_pattern_list'
whitelist:
type: object
additionalProperties: true
properties:
include:
'$ref': '#/definitions/path_pattern_list'

params:
# @todo
type: object
additionalProperties: true

gherkin:
# @todo
type: object
additionalProperties: true

actor:
type: string

step_decorators:
type: array
items:
type: string

path_pattern_list:
type: array
items:
type: string

type: object
properties:
actor_suffix:
'$ref': '#/definitions/actor_suffix'
namespace:
'$ref': '#/definitions/namespace'
include:
'$ref': '#/definitions/include'
paths:
'$ref': '#/definitions/paths'
extends:
'$ref': '#/definitions/extends'
suites:
'$ref': '#/definitions/suites'
modules:
'$ref': '#/definitions/modules'
extensions:
'$ref': '#/definitions/extensions'
reporters:
'$ref': '#/definitions/reporters'
groups:
'$ref': '#/definitions/groups'
bootstrap:
'$ref': '#/definitions/bootstrap'
settings:
'$ref': '#/definitions/settings'
coverage:
'$ref': '#/definitions/coverage'
params:
'$ref': '#/definitions/params'
gherkin:
'$ref': '#/definitions/gherkin'
actor:
'$ref': '#/definitions/actor'
step_decorators:
'$ref': '#/definitions/step_decorators'
146 changes: 146 additions & 0 deletions schema/suite.schema.yml
@@ -0,0 +1,146 @@
$id: 'https://codeception.com/1/suite.schema.yml'
$schema: 'https://json-schema.org/draft/2020-12/schema'
title: 'suite.dist.yml'
description: 'Schema definition for Codeception suite configuration YAML files.'

type: object
additionalProperties: true
properties:
actor:
oneOf:
-
type: 'null'
-
type: string

modules:
type: object
additionalProperties: true
properties:
enabled:
type: array
items:
oneOf:
-
type: string
-
type: object
additionalProperties: true
maxProperties: 1
minProperties: 1
config:
type: object
additionalProperties: true
depends:
# @todo
type: array
items:
type: string

step_decorators:
# @todo
type: array
items:
type: string

path:
# @todo
oneOf:
-
type: 'null'
-
type: string

extends:
# @todo
oneOf:
-
type: 'null'
-
type: string

namespace:
oneOf:
-
type: 'null'
-
type: 'string'

groups:
# @todo
type: array
default: [ ]

formats:
# @todo
type: array
default: [ ]

extensions:
type: object
additionalProperties: true
properties:
enabled:
type: array
items:
type: string
config:
type: object
additionalProperties: true

error_level:
type: string
default: 'E_ALL & ~E_STRICT & ~E_DEPRECATED'

colors:
type: boolean
default: true

strict_xml:
type: boolean
default: false

lint:
type: boolean
default: true

backup_globals:
type: boolean
default: true

log_incomplete_skipped:
type: boolean
default: false

report_useless_tests:
type: boolean
default: false

disallow_test_output:
type: boolean
default: false

be_strict_about_changes_to_global_state:
type: boolean
default: false

shuffle:
type: boolean
default: false

suite_class:
type: string

memory_limit:
type: string

log:
type: boolean

class_name:
type: string

steps:
type: array
items:
type: string