Skip to content

Commit

Permalink
schema: schema-out
Browse files Browse the repository at this point in the history
  • Loading branch information
yfzhe committed Jan 25, 2024
1 parent 0344688 commit 8e512de
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion telebot/private/schema.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
syntax/parse/pre
racket/syntax
racket/string
racket/provide-transform
syntax/parse/experimental/template
threading))

(provide define-schema
(provide define-schema schema-out
integer? string? boolean? true? listof
optional
define-api ->
Expand Down Expand Up @@ -230,6 +231,21 @@
set-field-value ...
jsexpr))]))

(define-syntax schema-out
(make-provide-transformer
(lambda (stx mode)
(syntax-parse stx
[(_ id:schema-id)
#:do [(define info (attribute id.info))
(define pred (schema-info-pred info))]
(define export-ids
(list #'id
pred
(format-id #'id "schema:id" #'id)))
(for/list ([eid (in-list export-ids)])
(make-export eid (syntax-e eid) 0 #f eid))])))
)

(define-syntax (ref stx)
(syntax-parse stx
#:literals (:)
Expand Down

0 comments on commit 8e512de

Please sign in to comment.