Giter VIP home page Giter VIP logo

Comments (3)

magicmatatjahu avatar magicmatatjahu commented on May 29, 2024

@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} and setAdditionalProperty(key: string, value: {type}): void.
  • in Java we can make something similar public {type} getAddtionalProperty(String key) { this.additionalProperties.get(key) } and similar setAdditionalProperty.

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.

github-actions avatar github-actions commented on May 29, 2024

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.

asyncapi-bot avatar asyncapi-bot commented on May 29, 2024

🎉 This issue has been resolved in version 0.11.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from modelina.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.