Comments (3)
@jonaslagoni You pinged me about problems with addProperties
etc in slack, so I give you some tips here, also to check by another people from community:
For additionalProperties
:
- in TS and JS we should render for additionalProperties additional accessor for set and get, but not native, but something like
getAdditionalProperty(key: string): {type}
andsetAdditionalProperty(key: string, value: {type}): void
. - in Java we can make something similar
public {type} getAddtionalProperty(String key) { this.additionalProperties.get(key) }
and similarsetAdditionalProperty
.
For patternProperties
situation is very similar to additionalProperties
. We have an example:
{
"type": "object",
"patternProperties": {
"^S_": { "type": "string" },
"^I_": { "type": "integer" }
},
"additionalProperties": false
}
- in TS and JS we should render:
patternProperties: Record<string, any>;
getPatternProperty(key: string): {type | undefined} {
return patternProperties[key];
}
setPatternProperty(key: string, value: any): void {
// here we must check patterns
if (/^S_/.test(key) && typeof value === "string") {
this.patternProperties[key] = value;
}
if (/^I_/.test(key) && typeof value === "number") {
this.patternProperties[key] = value;
}
// maybe throw error
}
- for Java very similar like for TS - additional get and set for patternProperties and inside them check pattern before saving data.
additionalProperties
and patternProperties
you can render in 2 ways:
- using
additionalContent
preset for class here or - adjust
renderProperties
in appropriate renderer
from modelina.
This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️
from modelina.
🎉 This issue has been resolved in version 0.11.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from modelina.
Related Issues (20)
- Change C# Equals() overload to allow reference type properties to be properly compared HOT 13
- [BUG] C# setter for property named `value` prevents assignment. HOT 4
- Allow changing `additionalProperties` property name interpretation
- [BUG] AsyncAPI generator for Java doesn't generate class correctly when there's reference to itself HOT 14
- [FEATURE] Generate code from OpenAPI spec without paths HOT 9
- Java generator does not include import for dictionary models
- Weird behavior with self referencing models not create correct types HOT 1
- AsyncAPIInputProcessor does not respect schemaFormat of the message HOT 2
- Python generator does not handle self reference types correctly
- schemaMapping configuration to re-use existing model classes HOT 4
- Modelina CLI windows build failing HOT 2
- [BUG] Implement avro schema data type HOT 1
- Lonely `additionalProperties` does not generate dictionary type
- Tuple types in marshalling are generated with syntax errors
- Java marshalling preset generate code with syntax errors
- Java jackson preset not serializing dictionary models with unwrap option correctly
- Enable java jackson preset feature to serialize/deserialize unwrappable dictionaries
- [FEATURE] Change the name of the generated model class withe name of message name. HOT 1
- [BUG] Pydantic generator does not correctly handle nullable union HOT 3
- [FEATURE] export AbstractDependencyManager to allow overriding HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modelina.