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

Query for supported properties, for a supported post-type #33

Open
jamietanna opened this issue Jul 25, 2020 · 10 comments
Open

Query for supported properties, for a supported post-type #33

jamietanna opened this issue Jul 25, 2020 · 10 comments

Comments

@jamietanna
Copy link

As per my comment on #1, I would like an extension to configuration queries that would allow me to discover which properties are supported for a post-type.

My proposal from #1 (comment) is to perform i.e. GET /q=post-types&post-type=note.

This would support Query for Supported Properties syntax, but be specific to the given post-type we want to interrogate.

@jamietanna
Copy link
Author

Or as suggested by @manton off the back of this #8 (comment)

@manton
Copy link

manton commented Aug 3, 2020

I've implemented a version of this in Micro.blog to see how it would look. It returns the supported properties directly from q=config without needing any extra requests. My initial implementation looks like this, although it's probably missing some properties.

{
  "media-endpoint": "https://micro.blog/micropub/media",
  "destination": [
    {
      "uid": "https://manton.micro.blog/",
      "name": "www.manton.org"
    }
  ],
  "post-types": [
    {
      "type": "note",
      "name": "Post",
      "properties": [ "content", "published", "post-status", "category", "read-of", "mp-destination", "checkin", "location" ]
    },
    {
      "type": "article",
      "name": "Article",
      "properties": [ "name", "content", "published", "post-status", "category", "mp-channel", "mp-destination" ]
    },
    {
      "type": "photo",
      "name": "Photo",
      "properties": [ "name", "content", "published", "post-status", "category", "mp-destination", "photo", "mp-photo-alt" ]
    },
    {
      "type": "reply",
      "name": "Reply",
      "properties": [ "content", "in-reply-to" ]
    },
    {
      "type": "bookmark",
      "name": "Favorite",
      "properties": [ "bookmark-of" ]
    }
  ],
  "channels": [
    {
      "uid": "default",
      "name": "Posts"
    },
    {
      "uid": "pages",
      "name": "Pages"
    }
  ]
}

@jamietanna
Copy link
Author

Looks good, @manton. I'm wondering about making some distinction between required/optional properties, as I'll have different handling for them internally, and it may be good for the client to be able to provide some feedback to the user if they're not provided. What do you think?

@manton
Copy link

manton commented Aug 3, 2020

Personally I'm having trouble seeing where required properties would be needed. As an example, technically name is required for an article, but if someone leaves it blank, it doesn't really matter. If a client really does need the concept of required properties, maybe that logic should be baked into the client instead of generalized for all servers.

@jamietanna
Copy link
Author

I have implemented this, and have added the required-properties key to provide a hint to a client which of these should be validated:

{
    "syndicate-to": [
	...
    ],
    "media-endpoint": "https://www-api.jvt.me/micropub/media",
    "q": [
        "post-types",
	...
    ],
    "post-types": [
        {
            "type": "bookmark",
            "name": "Bookmark",
            "properties": [
                "bookmark-of",
                "name",
                "published",
                "category",
                "content",
                "syndication"
            ],
            "required-properties": [
                "bookmark-of",
                "name",
                "published"
            ]
        },
        {
            "type": "like",
            "name": "Like",
            "properties": [
                "like-of",
                "published",
                "category",
                "content",
                "name",
                "syndication"
            ],
            "required-properties": [
                "like-of",
                "published"
            ]
        },
        {
            "type": "reply",
            "name": "Reply",
            "properties": [
                "content",
                "in-reply-to",
                "published",
                "category",
                "name",
                "photo",
                "syndication"
            ],
            "required-properties": [
                "content",
                "in-reply-to",
                "published"
            ]
        },
        {
            "type": "repost",
            "name": "Repost",
            "properties": [
                "published",
                "repost-of",
                "content",
                "category",
                "syndication"
            ],
            "required-properties": [
                "published",
                "repost-of"
            ]
        },
        {
            "type": "rsvp",
            "name": "RSVP",
            "properties": [
                "in-reply-to",
                "published",
                "rsvp",
                "category",
                "content",
                "syndication"
            ],
            "required-properties": [
                "in-reply-to",
                "published",
                "rsvp"
            ]
        },
        {
            "type": "note",
            "name": "Note",
            "properties": [
                "content",
                "published",
                "category",
                "syndication"
            ],
            "required-properties": [
                "content",
                "published"
            ]
        },
        {
            "type": "photo",
            "name": "Photo",
            "properties": [
                "photo",
                "published",
                "category",
                "content",
                "syndication"
            ],
            "required-properties": [
                "photo",
                "published"
            ]
        },
        {
            "type": "step",
            "name": "Step Counts",
            "properties": [
                "unit",
                "num",
                "start",
                "end"
            ],
            "required-properties": [
                "unit",
                "num",
                "start",
                "end"
            ]
        },
        {
            "type": "event",
            "name": "Event",
            "properties": [
                "end",
                "name",
                "published",
                "start",
                "content",
                "url"
            ],
            "required-properties": [
                "end",
                "name",
                "published",
                "start"
            ]
        },
        {
            "type": "contact",
            "name": "Contact",
            "properties": [
                "name",
                "nickname",
                "url",
                "rel=twitter"
            ],
            "required-properties": [
                "name",
                "nickname",
                "url"
            ]
        }
    ]
}

@jamietanna
Copy link
Author

I have updated my implementation to also expose an h property:

    {
      "type": "bookmark",
      "name": "Bookmark",
      "h": "entry",
      "properties": [
        "bookmark-of",
        "name",
        "published",
        "category",
        "content",
        "syndication"
      ],
      "required-properties": [
        "bookmark-of",
        "name",
        "published"
      ]
    }

@barryf
Copy link

barryf commented Oct 15, 2020

@jamietanna I'm working on supporting this with Micropublish, including required-properties.

In your example above I wanted to query how you treat syndication. I have syndication and mp-syndicate-to as separate properties. When creating a post I don't want to specify syndication URLs, but I do want to choose targets via mp-syndicate-to. Does your syndication property refer to both use cases?

@jamietanna
Copy link
Author

That's a good point - it's not one I'd considered. It's also uncovered a bug (or maybe a feature 🤷🏽‍♂️) where sending syndication does not get sanitised like mp-syndicate-to

(Originally published at: https://www.jvt.me/mf2/2020/10/lqei3/)

@manton
Copy link

manton commented Feb 23, 2022

Just reviewing this, it seems like it is close to being considered a stable extension. Maybe there aren't 3 clients yet, though?

@jalcine
Copy link

jalcine commented Mar 18, 2022

Hm, not yet. My website works as a Micropub client but I don't know if that actually counts here.

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

4 participants