Find

Digest
· Nov 10

Nuevas publicaciones en la Comunidad de InterSystems, 3-9 noviembre

Artículos
Anuncios
Preguntas
#Caché
3-9 noviembreWeek at a GlanceInterSystems Developer Community
Digest
· Nov 10

Publications des développeurs d'InterSystems, semaine Novembre 03 - 09, 2025, Résumé

Novembre 03 - 09, 2025Week at a GlanceInterSystems Developer Community
Question
· Nov 10

Foreign Table datatypes

Hello!

I'm trying to create some foreign tables to a PostgreSQL database. In some cases, columns with certain datatypes cannot be consumed by IRIS and the following error is thrown:

 [SQLCODE: <-237>:<Schema import for foreign table did not return column metadata>]

  [%msg: <Unkown data type returned by external database>]

For example: serial4 typed ID columns are typical examples. Is it possible, what's the best way of resolving these datatypes, which- seemingly- don't have proper JDBC metadata mappings?

Of course, explicitely defining columns and types as part of the CREATE FOREIGN TABLE statement solves the problem, but when working with large number of foreign tables and unknown number of potentially problematic datataypes, this can be cumbersome.

 

Thank you for any help in advance!

Attila Toth

Discussion (0)1
Log in or sign up to continue
Article
· Nov 10 3m read

_spec para swagger-ui desde la clase de spec

Seguramente queríais usar la especificación OpenAPI (OAS) en formato JSON que utilizasteis para vuestra clase spec en el paquete iris-web-swagger-ui de IRIS.
La OAS generada por el método ##class(%REST.API).GetWebRESTApplication(...) es muy básica, sin descripciones de los parámetros ni de la estructura esperada de las respuestas.

Así que, después de crear vuestra aplicación REST a partir de una OAS, deberíais tener:

  • Una clase application.disp.cls generada
  • Una clase application.spec.cls (añadiremos una ruta hacia la especificación OpenAPI que se encuentra en la propiedad "XData OpenAPI")
  • Una clase application.impl.cls (solo implementaremos el método GetSpec)

Si instalasteis el paquete iris-web-swagger-ui (https://openexchange.intersystems.com/package/iris-web-swagger-ui), necesitáis un endpoint que devuelva la OAS.

Mi enfoque consiste en añadir una ruta hacia la OAS en la clase spec y aplicarla usando la propiedad "OpenAPI" de dicha clase spec. Esto os permitirá, por ejemplo, tener disponible para pruebas toda la estructura del OAS original.

En la clase de ejemplo del paquete iris-web-swagger-ui (Sample.PersonREST), hay una implementación del método SwaggerSpec que actualiza algunas propiedades para reflejar lo que está configurado en la Aplicación Web de IRIS. Si seguís este procedimiento, recomiendo actualizar directamente la OAS en la clase spec para proporcionar esa información y así centralizar la documentación de vuestra API (aunque siempre podéis actualizarla en el método GetSpec que os muestro como ejemplo).

Siguiendo el ejemplo de la clase Sample.PersonREST, la ruta será /_spec. Aunque existe un valor para la etiqueta "basePath", este será reemplazado por el nombre de la Aplicación Web de IRIS.

Class application.spec Extends %REST.Spec [ProcedureBlock]
{

XData OpenAPI [ MimeType = application/json ]
{
{
  ...
  "basePath":"/api/myapi",
  ...
  "paths":{
    "/_spec": {
      "get":{
        "operationId":"GetSpec",
        "description":"This OpenAPI Spec",
        "produces":[
          "application/json"
        ],
        "responses":{
          "200":{
            "description":"Successful operation"
            }
          }
        }
    }, 
...

Lo siguiente es pegar este código sencillo en la clase de implementación. Concretamente, después de compilar la clase spec, la clase impl tiene un nuevo método (GetSpec) que debe devolver un objeto dinámico (el comentario principal proviene de la OAS en la clase spec y de la etiqueta "description" del "get" en la ruta). Debéis reemplazar "application.spec" por la referencia a vuestra propia clase de aplicación.

/// This OpenAPI Spec
ClassMethod GetSpec() As %DynamicObject
{
    Set spec = {}.%FromJSON(##class(%Dictionary.CompiledXData).%OpenId("application.spec||OpenAPI").Data.Read())
    Set spec.basePath = %request.Application
    Return spec
}

¡Eso es todo!

Ahora id a vuestro iris-web-swagger-ui (en mi caso, http://localhost:52773/swagger-ui/index.html) y probad explorando en “http://localhost:52773/api/myapi/_spec” dentro del campo de navegación de swagger-ui.

Nota: definí una Aplicación Web llamada /api/myapi con “application.disp” como su “clase de despacho” (Dispatch class).

Discussion (0)1
Log in or sign up to continue
Article
· Nov 10 2m read

FastJsonSchema: Native High-Performance JSON Validation for IRIS

FastJsonSchema: High-Performance JSON Validation in IRIS

Validating JSON data against JSON Schema is a common requirement for modern applications. FastJsonSchema brings this capability natively to InterSystems IRIS, combining speed, simplicity, and full schema compliance.

Unlike traditional validation approaches, FastJsonSchema generates native ObjectScript code from your JSON Schemas and compiles it directly to iris object code, enabling idiomatic performance without relying on external libraries or runtimes.

Why Use FastJsonSchema?

  • Native IRIS Code Generation – Compile your JSON Schema directly into ObjectScript and object code for lightning-fast execution.
  • High Performance – Fine-grained optimizations provide significant speed improvements, especially for repeated validations.
  • Detailed Validation – Validate at the property level with full adherence to JSON Schema rules.
  • Simple API – Compile schemas and validate JSON in just a few lines of code.
  • No External Dependencies – 100% native; no Python, Java, or other runtimes required.
  • Reusable Precompiled Schemas – Compile once, validate many times, reducing runtime overhead.

Supported JSON Schema Drafts

  • Draft-07

Getting Started

Compile a JSON Schema into native code:

Set sc = ##class(FastJsonSchema.Core).Compile(schema, schemaName)

Validate JSON data against a compiled schema:

Set sc = ##class(FastJsonSchema.Core).Validate(schemaName, pJSON)

Performance Tips

  • Compile Once, Use Many Times – Precompile schemas to object code to maximize speed.
  • Use Granular Schemas – Breaking complex JSON objects into smaller schemas improves validation efficiency.
  • Handle Exceptions Gracefully – Catch to manage invalid JSON cleanly.

With FastJsonSchema, Achieve the perfect balance of performance and flexibility — validating JSON data natively, efficiently, and with confidence.

1 new Comment
Discussion (1)1
Log in or sign up to continue