Giter Site home page Giter Site logo

simonuwe / oracle-apex-json-region Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 1.0 8.03 MB

An Oracle-APEX-plugin that provides for each property of a JSON-schema an input field to support an easy way to display and edit a JSON item

License: Apache License 2.0

CSS 0.74% JavaScript 99.26%
json json-schema oracle-apex-plugin

oracle-apex-json-region's People

Contributors

simonuwe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rts-richardw

oracle-apex-json-region's Issues

configurable labels

Currently labels are derived from property-names.

implement optional assignment of labels to properties.

identifiers in JSON data/schema must be enclosed by "

The ORACLE check "IS JSON" classifies more JSON variants as valid than the javascript JSON.parse.
The main issue is that identifiers must be enclosed by " for Javascripts JSON.parse, but in Oracles IS JSON the enclosing by " is optional.

Workarround: Use only " enclosed identifiers in JSON-schema/data or use CHECK-constraint
IS JSON(STRICT).

Oracle:

SQL> select '{a: 1}' is json "is json" from dual;

   is json
----------
         1
SQL> select '{a: 1}' is json(strict) "is json" from dual;

   is json
----------
         0
SQL> select '{"a": 1}' is json "is json" from dual;

   is json
----------
         1

Javascript:

JSON.parse('{a:1}');
Uncaught SyntaxError: Unexpected token a in JSON at position 1
JSON.parse('{"a":1}');
{ a: 1 }

support of "additionalProperties"

When "additionalProperties" is defined and != false, properties not mentioned in the object are kept when updating the data.

This schema-property could be overwritten by JSON-region-configuration Keep attributes when not set or is false.

Support of "dependentRequired"

Support den "dependentRequired" attribute of json-schema.

"dependentRequired": {
    "credit_card": ["billing_address"]
  }

This means: when item credit_card is filled then billing address must be filled too.

Header for subobjects

If JSON contains subobjects with similar content/fields a header make usage more userfriendly

[Lastname] [Firstname]
Company Address
[ZIP] [City]

Postal Address
[Zip] [City]

css lost for APEX-22.1

APEX-22.1 does not automatically minimize .css files. but the File-include uses die json-region#MIN#.css.

Works fine as long you are in Debug mode (here the non-min-files are used).

Solution: remove the #MIN# (file is only 3 lines).

array of properties

support of arrays like

{
  "type":"object",
  "properties": {
    "lastname": {"type": "string"},
    "firstname": {"type: "string"},
    "emails": {"type": "array",
      "maxItems": 3,
      "items": { "type": "object",
         "properties": {
           "email": {"type": "string"},
           "type":  {"type": "string"}
      }
    .....
   }
}

Support of $defs

Support $defs+ partly (local) $ref to simplify definition of recureing property types.

nested object properties

support of recursive object-types in json-schema like

{
  "type":"object",
  "properties": {
    "lastname": {"type": "string"},
    "firstname": {"type: "string"},
    "address": {"type": "object",
                "properties": {
    .....
   }
  [
}

use more apex.widget....

Check whether it is possible to use more of the javascript-widgets

  • widget.yesNo
  • widget.starRating
  • widget.selectList
  • ...

default labels with 1st char upper

display lables with same default format as APEX-page-designer.
Seperate to single words, 1st char upper, rest lower.
"created_at" > "Created At"

Oracle 23c JSON-schema and date

Oracle uses in the JSON-schema for validating a JSON for validation date values an new type

...
{
   "extendedType"="date".
   ...
}

JSON-schema docu specifies here

...
{
  "type": "string", 
  "format="date",
  ...
}

This extendedType must be handled properly.

Refresh JSON-region on demand

Plugin is only initiallized when page is displayed first.

It should be possible to change content of region with an event (click, changed data, ...) or on demand

additional UI-items

Support of optional UI-item-types

  • boolean attributes switch
  • integer starrating
  • long strings markdown-editor instead of textarea

support of conditional JSON-schema "IF", "THEN", "ELSE"

Support of conditions schema

Idea:
Depending on a type property parts of the UI are hidden.

Example:
Property
"differentBillingaddress": "true"
requires the input of a 2nd address.

 ...
"address": {"$ref": "#/$defs/address"},
"differentBillingaddress": {"type": "boolean"},
"if":{
   "properties": {
     "differentBillingaddress": { "const": true }
   }
}.
"then": {
  "properties": {
    "billingAddress": {"$ref": "#/$defs/address"}
  }
},
...

Automatic JSON-schema with Oracle 23c

Oracle 23c supports a validation constraint for JSON-columns to check the data with a JSON-schema.
This JSON-schema should be used for an "automatic mode* .
The definition of such a column looks like

IS JSON VALIDATE '{
  "type"       : "object",
  "required": {"c1", "c2"],
  "properties": {
    "c1": {...},
    "c2": {...},
    "c3": {...},
   ----
}'

array of "simple properties" with checkboxes

1st step for array support

{
  "type":"object",
  "properties": {
    "lastname": {"type": "string"},
    "firstname": {"type: "string"},
    "prop": {
      "type": "array",
      "items": { "type": "string", "enum": ["sel1", "sel2", ...]
   }
}

#2

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.