Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languageyml
themeMidnight
   components:
     parameters:
       PolicyId:
         name: policyId
         in: path
         required: true
         schema:
           type: string

   paths:
     /policies/{policyId}:
       get:
         parameters:
           - $ref: '#/components/parameters/PolicyId'

Schema Usage in Paths

SchemaCountPaths
ErrorInformation4/policies/{policyId}, /policytypes/{policyTypeId}/policies, /policytypes/{policyTypeId}/policies/{policyId}, /policytypes/{policyTypeId}/policies/{policyId}/status
JsonSchema2/policytypes/{policyTypeId}/policies, /policytypes/{policyTypeId}/policies/{policyId}
NearRtRicId3/policies, /policies/{policyId}, /policytypes/{policyTypeId}/policies
NotificationDestination1/policies/{policyId}
PolicyId3/policies, /policies/{policyId}, /policytypes/{policyTypeId}/policies
PolicyInformation2/policies/{policyId}, /policytypes/{policyTypeId}/policies/{policyId}
PolicyObjectInformation1/policytypes/{policyTypeId}/policies/{policyId}/status
PolicyStatusObject2/policies/{policyId}, /policytypes/{policyTypeId}/policies/{policyId}/status
PolicyTypeId3/policytypes/{policyTypeId}/policies, /policytypes/{policyTypeId}/policies/{policyId}, /policytypes/{policyTypeId}/policies/{policyId}/status
PolicyTypeInformation2/policytypes/{policyTypeId}/policies, /policytypes/{policyTypeId}/policies/{policyId}
PolicyTypeObject1

/policytypes/{policyTypeId}/policies/{policyTypeId}/status

Using allOf to Extend Objects

To avoid using the `required` flag directly and create more flexible schemas, we can use the allOf keyword to combine schemas. This allows you to create an extended schema from an original one without repeating required properties.

https://openapi-generator.tech/docs/generators/spring/#schema-support-feature 



From the documentation of the openapi generator used in A1PMS, AllOf is not supported for spring server generator. But it still generated objects without the use of extending the parent class. For example:



An extended object in the specification yaml:

Code Block
languageyml
themeMidnight
components:
  schemas:
    Policy:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
    PolicyExtended:
      allOf:
        - $ref: '#/components/schemas/Policy'
        - type: object
          properties:
            description:
              type: string





Code Block
languagejava
themeMidnight
public class Policy {

  private String id;
  private String name;
...
}

public class PolicyExtended{

  private String id;
  private String name;
  private String description;
...
}




























...

TODO and topic to follow

- Evaluate the necessity of optional fields: Determine if certain optional fields can be removed or if their use can be better documented to avoid dead data.
- Consider adopting more specific schemas for critical operations: This can improve both the documentation and the generated code quality.
- Prepare for code adaptations: Implement patterns like Adapter/Builder/Transformer to handle translations between similar objects, facilitating easier maintenance and adaptation to specification changes.
- Regular compliance checks: Ensure regular checks against ORAN specifications to stay compliant and make necessary adjustments in a timely manner.
- Adopt Specific Schemas: Use specific schemas for different API operations to improve clarity and reduce the risk of errors.
- Implement Adapter Pattern: Use the Adapter pattern to manage differences between similar objects, ensuring compliance with ORAN specifications.
- Leverage OpenAPI Features: Use OpenAPI's advanced features like `allOf`, `oneOf`, `anyOf`, and discriminators to create flexible and reusable components.

...