示例#1
0
source_page_fields = api.model('HarvestSourcePage',
                               fields.pager(source_fields))

backend_fields = api.model(
    'HarvestBackend', {
        'id': fields.String(description='The backend identifier'),
        'label': fields.String(description='The backend display name')
    })

preview_dataset_fields = api.clone(
    'DatasetPreview', dataset_fields, {
        'uri':
        fields.UrlFor('api.dataset',
                      lambda o: {'dataset': 'not-available'},
                      description='The dataset API URI (fake)'),
        'page':
        fields.UrlFor('datasets.show',
                      lambda o: {'dataset': 'not-available'},
                      description='The dataset page URL (fake)'),
    })

preview_item_fields = api.clone(
    'HarvestItemPreview', item_fields, {
        'dataset':
        fields.Nested(preview_dataset_fields,
                      description='The processed dataset',
                      allow_null=True),
    })

preview_job_fields = api.clone(
示例#2
0
文件: api.py 项目: opendatateam/udata
    'default': fields.String(description='The feature default state (true is enabled)'),
})

backend_fields = api.model('HarvestBackend', {
    'id': fields.String(description='The backend identifier'),
    'label': fields.String(description='The backend display name'),
    'filters': fields.List(fields.Nested(filter_fields),
                           description='The backend supported filters'),
    'features': fields.List(fields.Nested(feature_fields),
                            description='The backend optional features'),
})

preview_dataset_fields = api.clone('DatasetPreview', dataset_fields, {
    'uri': fields.UrlFor(
        'api.dataset', lambda o: {'dataset': 'not-available'},
        description='The dataset API URI (fake)'),
    'page': fields.UrlFor(
        'datasets.show', lambda o: {'dataset': 'not-available'},
        description='The dataset page URL (fake)'),
})

preview_item_fields = api.clone('HarvestItemPreview', item_fields, {
    'dataset': fields.Nested(preview_dataset_fields,
                             description='The processed dataset',
                             allow_null=True),
})

preview_job_fields = api.clone('HarvestJobPreview', job_fields, {
    'items': fields.List(fields.Nested(preview_item_fields),
                         description='The job collected items'),
})