Skip to content

Creating getter and setter for additional properties on boolean true #31

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

Conversation

stephanniewerth
Copy link
Contributor

Best practice to work with additional properties are the generated methods setAdditionalPropertyValue and getAdditionalPropertyValues. In JSON schema you can set "additionalProperties": true. So far the methods will not been created, because you need a valid Schema instance (in JSON Schema: "additionalProperties": {"type": "string"})

This pull request will created these methods with PhpStdType::mixed() as Type. You have to activate this behavior with a flag:

$builder = new PhpBuilder();
$builder->buildAdditionalPropertyMethodsOnTrue = true;

@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #31 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #31      +/-   ##
============================================
+ Coverage     89.21%   89.28%   +0.06%     
- Complexity      513      516       +3     
============================================
  Files            38       38              
  Lines          1354     1362       +8     
============================================
+ Hits           1208     1216       +8     
  Misses          146      146
Impacted Files Coverage Δ Complexity Δ
src/JsonSchema/PhpBuilder.php 84.35% <100%> (+0.73%) 69 <0> (+3) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb613c9...f4c53bf. Read the comment docs.

@vearutop vearutop merged commit 4560478 into swaggest:master Jan 10, 2020
@vearutop
Copy link
Member

Thanks, v0.2.25 tagged.

@stephanniewerth stephanniewerth deleted the feature/build-additional-property-methods-on-true branch January 14, 2020 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants