Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line annotations not working with properties #20

Open
Tachi107 opened this issue Dec 27, 2024 · 0 comments
Open

Line annotations not working with properties #20

Tachi107 opened this issue Dec 27, 2024 · 0 comments

Comments

@Tachi107
Copy link

Hi! I've encountered a somewhat strange behaviour in oal, which to me looks like a bug. When annotating property declarations, I'm only able to use inline annotations, and not line (above) annotations.

It's clearer with some examples.

The following Oxlip code:

let id = 'id int `title: my title, description: my description`;

res /test on get -> { id };

produces (some fields omitted for brevity):

schema:
  type: object
  properties:
    id:
      title: my title
      description: my description
      type: integer

On the other hand, this other Oxlip code:

# title: my title
# description: my description
let id = 'id int;

res /test on get -> { id };

produces:

schema:
  type: object
  properties:
    id:
      type: integer

Note that there are no title or description keys.

I'm guessing that this is because in the first example the annotations get assigned to the "implicit" int type, while in the second case they get assigned to the property and discarded, for some reason.

I'm inclined to think this is what's happening also because given this Oxlip code:

# title: my title
let idType = int;

# description: this is going to get discarded
let id = 'id idType;

res /test on get -> { id };

I get:

schema:
  type: object
  properties:
    id:
      title: my title
      type: integer

As you can see, the description is discarded.

Note that this also seems to contradict the example at https://www.oxlip-lang.org/doc/overview.html#properties, where a description is added to a property declaration like above.

For completeness, the following Oxlip code works as intended:

# title: my title
let idType = int;

let id = 'id idType `description: my description`;

res /test on get -> { id };

as it produces:

schema:
  type: object
  properties:
    id:
      title: my title
      description: my description
      type: integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant